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

Variant Analysis Results fails to show results if query message contains placeholder which is not part of source #2622

Closed
Marcono1234 opened this issue Jul 19, 2023 · 2 comments · Fixed by #2672
Labels
bug Something isn't working VSCode

Comments

@Marcono1234
Copy link
Contributor

Marcono1234 commented Jul 19, 2023

Describe the bug
When a query contains a placeholder in the query message ($@), and the results of a Variant Analysis run have a value for that placeholder which is not part of the source of a project, then the Variant Analysis Results view fails to show results.

Additionally the following is logged in the extension log:

Error when processing SARIF result: TypeError: Cannot read properties of undefined (reading 'startLine')

Version
Extension version

CodeQL extension version: 1.8.8 
CodeQL CLI version: 2.14.0 
Platform: win32 x64

VS Code version

Version: 1.80.1 (user setup)
Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771
Date: 2023-07-12T17:22:07.651Z
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.19045

To reproduce

  1. Open Quick Query and paste the following query
    /**
     * @kind problem
     */
    
    import java
    
    // Pick arbitrary element which is part of source; chose EnumType here because projects
    // likely don't have that many enum types
    // TypeString comes from the JDK and is not part of the source of the project
    from EnumType t, TypeString notPartOfSource
    where t.fromSource()
    select t, "message $@", notPartOfSource, notPartOfSource.getName()
  2. Run Variant Analysis, for example on the top 10 repositories
  3. On the Variant Analysis Results view click the triangle to expand the results
    ❌ Bug: No results are shown and an error is logged

Expected behavior
Results should be shown, but if the placeholder value is not part of the source, there should simply not be a link.

(Also: Maybe in general if an error while processing the SARIF result happens, the complete stack trace should be printed to the log to make debugging easier?)

@Marcono1234 Marcono1234 added the bug Something isn't working label Jul 19, 2023
@robertbrignull
Copy link
Contributor

Thank you for reporting this. I've also been able to reproduce the missing results when one of the placeholder values is not from the source archive. I get the error Error when processing SARIF result: TypeError: Cannot read properties of undefined (reading 'startLine') when trying to expand the results.

This issue is very closely related to #2629, though perhaps not entirely the same because the results are present but just fail to display. In that issue the results that are not from the source are completely omitted.

We've got an internal issue to track this, but we'll report here when there's any progress on this.

@robertbrignull
Copy link
Contributor

This should be fixed now. It will be available in the next extension release, which is likely to happen sometime next week.

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
2 participants