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

SLVS-1668 Workaround for CFamily headers #5861

Draft
wants to merge 3 commits into
base: gb/vcx-migration
Choose a base branch
from

Conversation

michael-jabbour-sonarsource
Copy link

@michael-jabbour-sonarsource michael-jabbour-sonarsource commented Nov 29, 2024

SLVS-1668

Part of SLVS-1637

More details about the addressed problems can be found in the linked ticket. Might be easier to review commit-by-commit:

  • To communicate the header file language, I am adding the relevant switches to the generated command in the header case as well. This helps analyze C headers as such when they are located inside C VCX projects.
  • Since HeaderFileLanguage is no longer needed, I am removing it from FileConfig.
  • To communicate the fact that the current file is a header file, I am replacing the "file" field in the generated single-entry compilation database with a non-existent file. This helps fix some FPs that would otherwise be reported. The approach in this PR results in a confusing/irrelevant info log message "using compilation database random entry" being printed from the analyzer side. A long-term solution that requires modifications on the analyzer side is going to be implemented in a separate ticket (see Jira).

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod bot changed the title [WIP] Workaround for cfamily headers SLVS-1668 [WIP] Workaround for cfamily headers Nov 29, 2024
@michael-jabbour-sonarsource michael-jabbour-sonarsource changed the title SLVS-1668 [WIP] Workaround for cfamily headers [WIP] SLVS-1668 Workaround for cfamily headers Nov 29, 2024
@michael-jabbour-sonarsource michael-jabbour-sonarsource changed the title [WIP] SLVS-1668 Workaround for cfamily headers [WIP] SLVS-1668 Workaround for CFamily headers Nov 29, 2024
@michael-jabbour-sonarsource michael-jabbour-sonarsource force-pushed the mj/workaround_for_cfamily_headers branch 5 times, most recently from 3a5f1f7 to 0594303 Compare November 29, 2024 13:36
@michael-jabbour-sonarsource michael-jabbour-sonarsource force-pushed the mj/workaround_for_cfamily_headers branch 2 times, most recently from eae71b7 to 2013f6a Compare November 29, 2024 15:40
This helps analyze headers in C projects as C code. This is needed now
that we no longer pass HeaderFileLanguage separately to the analyzer.
Normally, the CFamily analyzer deduces that the file being analyzed is a
header when there is no exact match for the file name in the given
compilation database.

This is a temporary workaround to communicate with the analyzer that
the current file is a header file. This helps the analyzer avoid
reporting some FPs.

See https://sonarsource.atlassian.net/browse/CPP-2743
@michael-jabbour-sonarsource michael-jabbour-sonarsource changed the title [WIP] SLVS-1668 Workaround for CFamily headers SLVS-1668 Workaround for CFamily headers Nov 29, 2024
Copy link

sonarcloud bot commented Nov 29, 2024

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

Successfully merging this pull request may close these issues.

1 participant