-
Notifications
You must be signed in to change notification settings - Fork 660
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
Fix for ignoring test / directories by fqcn[deep] rule #4320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! There should probably be a test added case to check this, following the pattern of the other test cases in the fqcn.py
rule. One of the test cases you used during development would be good to add in.
b711631
to
706303a
Compare
706303a
to
816bcee
Compare
Quality Gate passedIssues Measures |
Fix issue #4160
Description:
This PR addresses issue #4160 by modifying the logic in
fqcn.py
to ensure that directories related to testing (i.e., those starting with "test") are skipped during processing. Previously, test directories were being evaluated, leading to unnecessary false positive warnings. (Skip test folders in fqcn.py)Changes:
fqcn.py
to check if a directory is a test folder.test
,tests
,testxyz
, orabctest
) are skipped.test_fqcn_deep_test_dir_pass
to verify that the rule does not flag files located in directories namedtest
or similar.Testing:
The new logic has been tested with various directory structures to ensure that any directory containing the word "test" is correctly skipped. The following cases have been verified:
/tests/unit/plugins/action/network/pr.py
/abc/unit/plugins/action/tests/pr.py
/abc/test/plugins/action/network/pr.py
/abctests/unit/plugins/action/network/pr.py
/testxyz/unit/plugins/action/network/pr.py
In all these cases, the test directories (or directories containing "test") were successfully ignored during processing.