Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error messages in extension log when quick evalling library files with CodeQL CLI v2.10.0 #1412

Merged
merged 3 commits into from
Jun 29, 2022

Conversation

henrymercer
Copy link
Contributor

Currently resolve ml-models only supports queryspecs, i.e. .ql, .qls, directory, and query pack specifications. However, a quick evaluation within a library will have a path ending in .qll, and currently the extension tries to call resolve ml-models on this path, logging an error message like this to the extension log:

[2022-06-29 10:15:25] Calling plumbing command: codeql resolve queries --additional-packs=/home/edoardo/semmle-code/ql --qlconfig-file=/home/edoardo/semmle-code/ql/qlconfig.yml --format startingpacks -- /home/edoardo/semmle-code/ql/cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll
A fatal error occurred: /home/edoardo/semmle-code/ql/cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll is not a .ql file, .qls file, a directory, or a query pack specification.
[2022-06-29 10:15:25] Exception caught at top level: /home/edoardo/semmle-code/ql/cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll is not a .ql file, .qls file, a directory, or a query pack specification.
                      com.semmle.cli2.resolve.ResolveQueriesCommand.resolveQuerySpecifier(ResolveQueriesCommand.java:237)
                      com.semmle.cli2.resolve.ResolveQueriesCommand.executeJSON(ResolveQueriesCommand.java:174)
                      com.semmle.cli2.resolve.ResolveQueriesCommand.executeJSON(ResolveQueriesCommand.java:71)
                      com.semmle.cli2.picocli.SimpleJsonSubcommand.executeInsistingOnJSON(SimpleJsonSubcommand.java:117)
                      com.semmle.cli2.picocli.PlumbingRunner.call(PlumbingRunner.java:54)
                      com.semmle.cli2.picocli.SubcommandCommon.callPlumbingInProcess(SubcommandCommon.java:126)
                      com.semmle.cli2.resolve.ResolveMlModelsCommand.resolvePackDependencies(ResolveMlModelsCommand.java:233)
                      com.semmle.cli2.resolve.ResolveMlModelsCommand.executeJSON(ResolveMlModelsCommand.java:92)
                      com.semmle.cli2.resolve.ResolveMlModelsCommand.executeJSON(ResolveMlModelsCommand.java:49)
                      com.semmle.cli2.picocli.SimpleJsonSubcommand.executeInsistingOnJSON(SimpleJsonSubcommand.java:117)
                      com.semmle.cli2.picocli.SimpleJsonSubcommand.executeSubcommand(SimpleJsonSubcommand.java:80)
                      com.semmle.cli2.picocli.SubcommandCommon.executeWithParent(SubcommandCommon.java:484)
                      com.semmle.cli2.execute.CliServerCommand.lambda$executeSubcommand$0(CliServerCommand.java:67)
                      com.semmle.cli2.picocli.SubcommandMaker.runMain(SubcommandMaker.java:205)
                      com.semmle.cli2.execute.CliServerCommand.executeSubcommand(CliServerCommand.java:67)
                      com.semmle.cli2.picocli.SubcommandCommon.call(SubcommandCommon.java:500)
                      com.semmle.cli2.picocli.SubcommandMaker.runMain(SubcommandMaker.java:205)
                      com.semmle.cli2.picocli.SubcommandMaker.runMain(SubcommandMaker.java:214)
                      com.semmle.cli2.CodeQL.main(CodeQL.java:98)

Couldn't resolve available ML models for /home/edoardo/semmle-code/ql/cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll. Running the query without any ML models: Error: Resolving ML models failed: [2022-06-29 10:15:25] Calling plumbing command: codeql resolve queries --additional-packs=/home/edoardo/semmle-code/ql --qlconfig-file=/home/edoardo/semmle-code/ql/qlconfig.yml --format startingpacks -- /home/edoardo/semmle-code/ql/cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll
A fatal error occurred: /home/edoardo/semmle-code/ql/cpp/ql/lib/semmle/code/cpp/internal/ResolveClass.qll is not a .ql file, .qls file, a directory, or a query pack specification.

With this PR, we no longer try to resolve ML models when doing a quick evaluation within a library. Instead, we print an informative message "Quick evaluation within a query library does not currently support using ML models. Continuing without any ML models." to the extension log.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

Currently `resolve ml-models` only supports queryspecs, i.e. .ql, .qls,
directory, and query pack specifications. Therefore quick evaluation within
a library isn't
supported.
@henrymercer henrymercer requested a review from a team as a code owner June 29, 2022 10:45
extensions/ql-vscode/CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Edoardo Pirovano <[email protected]>
@edoardopirovano edoardopirovano enabled auto-merge (rebase) June 29, 2022 10:54
@edoardopirovano edoardopirovano merged commit e9835cb into main Jun 29, 2022
@edoardopirovano edoardopirovano deleted the henrymercer/fix-quick-eval-ml-models-errors branch June 29, 2022 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants