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

Missing pretty name for MISRA in report generation #667

Open
g-ulli opened this issue Aug 29, 2024 · 1 comment
Open

Missing pretty name for MISRA in report generation #667

g-ulli opened this issue Aug 29, 2024 · 1 comment
Assignees
Labels

Comments

@g-ulli
Copy link

g-ulli commented Aug 29, 2024

Describe the bug
scripts/reports/analysis_report.py fails for .sarif file containing MISRA violations.

In our project, we have C files and C++ files. We want to use MISRA C for .c and .h files and Autosar C++14 for .cpp and .hpp files. A naive way to run both queries fails in the report generation because of this incomplete array:

standard_pretty_name = {
"cert": "CERT C++ 2016", "autosar": "AUTOSAR C++ R22-11, R21-11, R20-11, R19-11 and R19-03"}

Traceback (most recent call last):
  File ".../codeql-coding-standards/scripts/reports/analysis_report.py", line 63, in <module>
    utils.generate_guideline_compliance_summary(
  File ".../codeql-coding-standards/scripts/reports/utils.py", line 187, in generate_guideline_compliance_summary
    print("**Coding Standards applied**: " + ", ".join([standard_pretty_name[standard_short_name]
  File ".../codeql-coding-standards/scripts/reports/utils.py", line 187, in <listcomp>
    print("**Coding Standards applied**: " + ", ".join([standard_pretty_name[standard_short_name]
KeyError: 'misra'

To Reproduce

codeql database analyze \
    --format=sarifv2.1.0 \
    --output=autosar-misra.sarif \
    <codeql database> \
    <path to codeql-coding-standards>/cpp/autosar/src/codeql-suites/autosar-default.qls
    <path to codeql-coding-standards>/cpp/misra/src/codeql-suites/misra-default.qls

python3.9 <path to codeql-coding-standards>/scripts/reports/analysis_report.py \
    <codeql database> \
    autosar-misra.sarif \
    autosar-misra-report

Expected behavior
Normal report generation without errors

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • CodeQL Coding Standards version: 2.34.0
  • CodeQL version: CodeQL CLI bundle 2.14.6
  • Operating System: Linux
@g-ulli g-ulli added the bug Something isn't working label Aug 29, 2024
@lcartey lcartey self-assigned this Sep 4, 2024
@lcartey
Copy link
Collaborator

lcartey commented Sep 4, 2024

Thanks for the bug report! We will take a look at fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants