Skip to content

Commit 480bd48

Browse files
Merge pull request #2533 from github/robertbrignull/assert-pure
Update assert-pure.ql now that the /pure directory has been removed
2 parents 1499d90 + 8559d3b commit 480bd48

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

.github/codeql/queries/assert-pure.ql renamed to .github/codeql/queries/assert-no-vscode-dependency.ql

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
* @name Unwanted dependency on vscode API
33
* @kind path-problem
44
* @problem.severity error
5-
* @id vscode-codeql/assert-pure
6-
* @description The modules stored under `pure` and tested in the `pure-tests`
7-
* are intended to be "pure".
5+
* @id vscode-codeql/assert-no-vscode-dependency
6+
* @description The modules stored under `common` should not have dependencies on the VS Code API
87
*/
98

109
import javascript
@@ -13,12 +12,9 @@ class VSCodeImport extends ImportDeclaration {
1312
VSCodeImport() { this.getImportedPath().getValue() = "vscode" }
1413
}
1514

16-
class PureFile extends File {
17-
PureFile() {
18-
(
19-
this.getRelativePath().regexpMatch(".*/src/pure/.*") or
20-
this.getRelativePath().regexpMatch(".*/src/common/.*")
21-
) and
15+
class CommonFile extends File {
16+
CommonFile() {
17+
this.getRelativePath().regexpMatch(".*/src/common/.*") and
2218
not this.getRelativePath().regexpMatch(".*/vscode/.*")
2319
}
2420
}
@@ -34,7 +30,8 @@ query predicate edges(AstNode a, AstNode b) {
3430

3531
from Module m, VSCodeImport v
3632
where
37-
m.getFile() instanceof PureFile and
33+
m.getFile() instanceof CommonFile and
3834
edges+(m, v)
3935
select m, m, v,
40-
"This module is not pure: it has a transitive dependency on the vscode API imported $@", v, "here"
36+
"This module is in the 'common' directory but has a transitive dependency on the vscode API imported $@",
37+
v, "here"

0 commit comments

Comments
 (0)