Fix #13333 (better handling when source file is repeated in compile_commands.json)#7508
Merged
danmar merged 8 commits intocppcheck-opensource:mainfrom May 9, 2025
Merged
Conversation
Collaborator
Author
|
More tests are needed.. however when I run it manually I see improvement. |
There was a problem hiding this comment.
Pull Request Overview
This PR improves the handling of duplicate file entries in compile_commands.json (Fix #13333). Key changes include passing a new fileIndex parameter through various API functions and updating test cases to validate correct ordering and naming of duplicate files.
- Updated file handling in Summaries, Tokenizer, AnalyzerInformation, and cppcheck to include a fileIndex.
- New tests added in testimportproject.cpp, testanalyzerinformation.cpp, and dumpfile_test.py to verify duplicate file scenarios.
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/testsummaries.cpp | Adjusted Summaries::create call to pass a file index. |
| test/testimportproject.cpp | Added support and tests for handling duplicate file entries. |
| test/testanalyzerinformation.cpp | Updated analyzer information tests to check the new file index in file names. |
| test/cli/dumpfile_test.py | Added new test to verify dump file naming for duplicate source files. |
| lib/tokenize.h/.cpp | Updated simplifyTokens1 to accept a file index parameter. |
| lib/summaries.h/.cpp | Propagated fileIndex parameter to create analyzer info filenames. |
| lib/importproject.cpp | Integrated fileIndex mapping while importing compile commands. |
| lib/filesettings.h | Introduced fileIndex member. |
| lib/cppcheck.h/.cpp | Updated checkFile and checkClang functions to accept fileIndex. |
| lib/analyzerinfo.h/.cpp | Modified analyzer info file creation and parsing to include fileIndex. |
| gui/checkthread.cpp | Updated AnalyzerInformation call with the proper file index. |
Files not reviewed (1)
- Makefile: Language not supported
olabetskyi
reviewed
May 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.