Skip to content

Commit aacc243

Browse files
Don't report multiply usages of builtin VS Code commands
1 parent d3b2d0f commit aacc243

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/codeql/queries/unique-command-use.ql

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ class CommandName extends string {
5252
}
5353
}
5454

55+
/**
56+
* Matches one of the members of `BuiltInVsCodeCommands` from `extensions/ql-vscode/src/common/commands.ts`.
57+
*/
58+
class BuiltInVSCodeCommand extends string {
59+
BuiltInVSCodeCommand() {
60+
exists(TypeAliasDeclaration tad |
61+
tad.getIdentifier().getName() = "BuiltInVsCodeCommands" and
62+
tad.getDefinition().(InterfaceTypeExpr).getAMember().getName() = this
63+
)
64+
}
65+
}
66+
5567
/**
5668
* Represents a single usage of a command, either from within code or
5769
* from the command's definition in package.json
@@ -142,6 +154,6 @@ class CommandUsagePackageJsonCommandPalette extends CommandUsage, JsonObject {
142154
}
143155

144156
from CommandName c
145-
where c.getNumberOfUsages() > 1
157+
where c.getNumberOfUsages() > 1 and not c instanceof BuiltInVSCodeCommand
146158
select c.getFirstUsage(),
147159
"The " + c + " command is used from " + c.getNumberOfUsages() + " locations"

0 commit comments

Comments
 (0)