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

Creating skeleton query pack shows spurious CodeQL compilation errors #3220

Closed
Marcono1234 opened this issue Jan 10, 2024 · 3 comments · Fixed by #3845
Closed

Creating skeleton query pack shows spurious CodeQL compilation errors #3220

Marcono1234 opened this issue Jan 10, 2024 · 3 comments · Fixed by #3845
Labels
bug Something isn't working VSCode

Comments

@Marcono1234
Copy link
Contributor

Marcono1234 commented Jan 10, 2024

Describe the bug
When creating a skeleton query pack using the extension it creates an example query (example.ql) and opens it automatically.
However, it directly reports compilation errors there about unresolved modules. These errors seem to be spurious though, compiling the query works fine.

This is quite problematic because creating the example query is probably the first thing new users do, and it can be quite confusing if they directly run into (spurious) errors then.

Whether this error occurs seems to depend on the state of %userprofile%/.codeql (on Windows; possibly similar on Linux).

Version

CodeQL extension version: 1.11.0 
CodeQL CLI version: 2.15.5 
Platform: win32 x64

VS Code:

Version: 1.85.1 (user setup)
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:49:37.021Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045

To reproduce

  1. Close VS Code
  2. Delete %userprofile%/.codeql (on Windows)
    (to be safe verify first that it does not contain anything valuable)
  3. Open an empty folder with VS Code
  4. In the CodeQL tab under "Queries" click "Create one to get started", or alternatively run the command "> CodeQL: Create Query"
  5. Select "Java" as language
  6. Wait until the extension automatically opens the example.ql file
    ❌ Bug: The extension shows multiple compilation errors
    Compilation errors screenshot
  7. Try to run the query
    ✔️ Compilation succeeds, as expected

Expected behavior
The extension should not show spurious compilation errors

Additional context
Besides that I really like this functionality of creating a skeleton pack; this seems to make it really easy to get started (though I had been using the extension before, so maybe a real new user might experience this differently).

@Marcono1234 Marcono1234 added the bug Something isn't working label Jan 10, 2024
@shati-patel
Copy link
Contributor

Thanks for the issue and the reproduction steps, @Marcono1234! I've raised this internally too, so we'll take a look and get back to you ✨

@Marcono1234
Copy link
Contributor Author

Thanks! It seems a similar error also occurs for the "CodeQL: Install Pack Dependencies" command; after performing the command the extension still shows spurious "Could not resolve module" compilation errors. Maybe that is the same underlying issue?

@kaeluka
Copy link
Contributor

kaeluka commented Dec 2, 2024

I have just merged a PR that fixes the issue 🥳

Thank you for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working VSCode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants