Skip to content

Fix #13751 (cmdlineparser: --file-filter matching of looked up files in provided paths)#7517

Merged
danmar merged 3 commits intocppcheck-opensource:mainfrom
cppchecksolutions:fix-13751
May 12, 2025
Merged

Fix #13751 (cmdlineparser: --file-filter matching of looked up files in provided paths)#7517
danmar merged 3 commits intocppcheck-opensource:mainfrom
cppchecksolutions:fix-13751

Conversation

@danmar
Copy link
Copy Markdown
Collaborator

@danmar danmar commented May 8, 2025

No description provided.

@danmar danmar changed the title Fix #13751 (Allow that --file-filter is used on looked up files) Fix #13751 (cmdlineparser: --file-filter fails to match globbed files) May 9, 2025
@danmar danmar changed the title Fix #13751 (cmdlineparser: --file-filter fails to match globbed files) Fix #13751 (cmdlineparser: --file-filter matching of looked up files in provided paths) May 9, 2025
@danmar danmar requested review from Copilot and firewave May 9, 2025 08:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses issue #13751 by improving the matching of files in provided paths when using the --file-filter option. Key changes include:

  • Adding new tests to verify file filtering behavior with simplified paths and case differences.
  • Extending the matchglob and matchglobs functions to support a caseInsensitive parameter.
  • Updating the CmdLineParser to use the new filtering logic.
  • Updating the releasenotes accordingly.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/testcmdlineparser.cpp Added new test cases for file filter matching behavior.
releasenotes.txt Documented the fix for improved --file-filter matching.
lib/utils.h Updated function declarations for matchglob(s) to add case handling.
lib/utils.cpp Implemented caseInsensitive comparison in matchglob(s).
cli/cmdlineparser.h Declared a new filterFiles function.
cli/cmdlineparser.cpp Refactored file filtering logic to use filterFiles.

Comment thread lib/utils.cpp
const std::vector<std::string> fileFilters{"m1.c"};
const std::list<FileWithDetails> filesResolved{ FileWithDetails("M1.C", Standards::Language::C, 123) };
const std::list<FileWithDetails> files = CmdLineParser::filterFiles(fileFilters, filesResolved);
#ifdef _WIN32
Copy link

Copilot AI May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a comment clarifying that the test expects case-insensitive filtering only on Windows to aid maintainability and clarity of the platform-specific behavior.

Copilot uses AI. Check for mistakes.
@danmar danmar merged commit 5c432b1 into cppcheck-opensource:main May 12, 2025
53 checks passed
@danmar danmar deleted the fix-13751 branch May 17, 2025 08:15
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.

2 participants