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

Report fails with arg --quality-gate-status when there is just one analysis #266

Open
danielFesenmeyer opened this issue Apr 6, 2024 · 1 comment

Comments

@danielFesenmeyer
Copy link

For a new project (when there is just one analysis), report generation fails when the arg --quality-gate-status is specified.
When a second analysis has been done, the same report succeeds.

Observed with sonar-report version 3.1.3 and sonarqube docker installation based on sonarqube image sonarqube:10.4.1-community.

The following error occurs:

Error while getting quality gate status :  - Cannot read properties of undefined (reading 'date') -  -  - 
file:///mydir/node_modules/.pnpm/[email protected]/node_modules/sonar-report/index.js:405
        json.projectStatus.period.date
                                  ^

TypeError: Cannot read properties of undefined (reading 'date')
    at generateReport (file:mydir/node_modules/.pnpm/[email protected]/node_modules/sonar-report/index.js:405:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

The reason is that the API result does not contain the period entry, in case there is just one analysis.

I know this is a corner case, but I think it is possible to provide meaningful quality gate information (at least in case of overall quality gate definitions), even when no period information is available. WDYT?

@stealthrabbi
Copy link

I am also seeing this issue.

cwilli-it pushed a commit to cwilli-it/sonar-report that referenced this issue Sep 30, 2024
…e analysis exists

- Resolved issue soprasteria#266 where report generation fails due to missing period data in the API result.
- Added fallback mechanism to handle cases where only one analysis exists.
- Ensured that the report still generates with meaningful quality gate information.
thecampagnards pushed a commit that referenced this issue Oct 1, 2024
…e analysis exists (#272)

- Resolved issue #266 where report generation fails due to missing period data in the API result.
- Added fallback mechanism to handle cases where only one analysis exists.
- Ensured that the report still generates with meaningful quality gate information.

Co-authored-by: chuck-dubya <[email protected]>
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

No branches or pull requests

2 participants