External issues not importing in sonarqube

I am trying to import this issue as a external issue in sonarqube, in the logs import looks successful but it does not show up anywhere, can anyone help what am i missing?

this is a external-issue.json file that i am trying to import

{
    "issues": [
        {
            "engineId": "test",
            "ruleId": "rule1",
            "severity": "BLOCKER",
            "type": "BUG",
            "primaryLocation": {
                "message": "incompatible events defined",
                "filePath": "src/components/events.ts",
                "textRange": {
                    "startLine": 20,
                    "endLine": 20,
                    "startColumn": 1,
                    "endColumn": 10
                }
            },
            "effortMinutes": 20
        }
    ]
}

my sonarqube settings are as follows
“sonar.sources”: “src/components/events.ts”,
“sonar.externalIssuesReportPaths”: “test-reports/external-issues.json”

i am seeing the following in logs:
INFO: Sensor Import external issues report
INFO: Imported 1 issue in 1 file
INFO: Sensor Import external issues report (done) | time=55ms
INFO: 1/1 file analyzed, current file: /src/components/events.ts
INFO: Analysis report generated in 217ms, dir size=190.4 kB
INFO: Analysis report compressed in 19ms, zip size=25.4 kB
INFO: Analysis report uploaded in 484ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: …

Hi,

Welcome to the community!

Can we have a screenshot of the file in question?

 
Ann

Hi, thank you for your response.
did you want the screenshot of events.ts file? I may need security clearance from infosec before i post it here.
may i know what are we looking for in the events.ts file?

Hi,

What I’d like to see is at least one line where you think there should be an issue, and there isn’t.

 
Ann

Screenshot 2023-03-27 at 2.33.36 PM

Hi Ann, posting a screenshot of the events.ts file.

Suraj

Hi Suraj,

I’d like to see it in the SonarQube context. I want to see if there are any markers on the line.

 
Ann

I dont see anything on SonarQube, in the logs it shows the file is getting scanned but it does not show up on the dashboard.

I can see the following in logs:
INFO: 1/1 file analyzed, current file: /home/asruser/src/components/events.ts
INFO: Creating TypeScript program (done) | time=1099ms
INFO: Starting analysis with current program
INFO: Analyzed 0 file(s) with current program

attaching a screenshot of the SonarQube console

when using a filter, test:rule1 shows in the search box but there are no issues related with it.
can we setup a zoom call so that it’s easier to look at where the problem could be?

Hi,

Are you saying you can’t find events.ts in the Code tab?

 
Ann

the file is not there.

Hi,

Then this is not a question of “external issues not importing” but of analysis omitting files.

Please share your full analysis log.

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

I think that was the problem, scan omits the files that are not modified.
i can see the external issue now

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.