File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
javascript/ql/lib/external Expand file tree Collapse file tree 2 files changed +24
-0
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 1+ /**
2+ * @name Use of database type outside the language core
3+ * @description Database types should only be used in the language core, abstractions should be used elsewhere.
4+ * @kind problem
5+ * @problem.severity warning
6+ * @id ql/db-type-outside-core
7+ * @tags maintainability
8+ * @precision very-high
9+ */
10+
11+ import ql
12+
13+ from TypeExpr te
14+ where
15+ te .isDBType ( ) and
16+ not te .getLocation ( ) .getFile ( ) .getAbsolutePath ( ) .matches ( "%/lib/%" ) and
17+ exists ( File f | f .getAbsolutePath ( ) .matches ( "%/lib/%" ) ) and
18+ // it is needed in one case.
19+ not te = any ( Class c | c .getName ( ) = "SuppressionScope" ) .getASuperType ( ) and
20+ // QL-for-QL only has a src/ folder.
21+ not te .getLocation ( ) .getFile ( ) .getAbsolutePath ( ) .matches ( "%/ql/ql/%" ) and
22+ // tests are allowed to use DB types.
23+ not te .getLocation ( ) .getFile ( ) .getAbsolutePath ( ) .matches ( "%/test/%" )
24+ select te , "Database type used outside the language lib/ folder."
You can’t perform that action at this time.
0 commit comments