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
109import 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
3531from Module m , VSCodeImport v
3632where
37- m .getFile ( ) instanceof PureFile and
33+ m .getFile ( ) instanceof CommonFile and
3834 edges + ( m , v )
3935select 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