-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Too-many-branches
scanning returns different values if directories to scan are explicitly specified.
#6242
Comments
I have also run into this bug. It is counting the number of branches for each way that the scanned file is being reached by Pylint. So, reaching the same module two different ways doubles the count of branches in each of its functions. Here is a simple reproduction.
''' Simple reproducer for 'too-many-branches' bug. '''
def too_many_branches( lol ):
''' Each branch is counted once per file reference. '''
aaa = 1
if aaa > lol: aaa = lol
else: aaa = 42
Environment:
|
Thank you for investigating @emcd, do you want to contribute a fix ? |
Closes pylint-dev#6242 May also address pylint-dev#4053
@Pierre-Sassoulas : "Want to contribute" is a relative term, but, sure, I'll contribute. :) I've benefited from Pylint much over the years and Daniel and Tyler have fixed other issues I've filed. PR #7747 seems to fix this issue. I still need to consider whether I can do anything to validate it with the test suite, but it is otherwise ready. |
* Use dict for 'expand_modules' result rather than list. With 'path' as the key, we get deduplication for free and do not need to reprocess the list for deduplication later. * Fix deduplication to account for CLI args marker. * Fix corner case with CLI arg flag handling during deduplication. * Add 'deduplication' to custom Pyenchant dict. Closes #6242 Closes #4053 Co-authored-by: Eric McDonald <[email protected]> Co-authored-by: Pierre Sassoulas <[email protected]>
…#7747) * Use dict for 'expand_modules' result rather than list. With 'path' as the key, we get deduplication for free and do not need to reprocess the list for deduplication later. * Fix deduplication to account for CLI args marker. * Fix corner case with CLI arg flag handling during deduplication. * Add 'deduplication' to custom Pyenchant dict. Closes pylint-dev#6242 Closes pylint-dev#4053 Co-authored-by: Eric McDonald <[email protected]> Co-authored-by: Pierre Sassoulas <[email protected]>
* Use dict for 'expand_modules' result rather than list. With 'path' as the key, we get deduplication for free and do not need to reprocess the list for deduplication later. * Fix deduplication to account for CLI args marker. * Fix corner case with CLI arg flag handling during deduplication. * Add 'deduplication' to custom Pyenchant dict. Closes #6242 Closes #4053 Co-authored-by: Eric McDonald <[email protected]> Co-authored-by: Pierre Sassoulas <[email protected]>
Bug description
In scanning my PyMarkdown project, a switch to pylint==2.13.5 caused some errors to show up with pylint. Specifically, when
pipenv run pylint --rcfile=setup.cfg pymarkdown pymarkdown/plugins
was executed, this was the response:However, upon using either
pipenv run pylint --rcfile=setup.cfg --recursive=y pymarkdown
or specifying the file directly, the errors were not reported.Command used
Command to generate bad behavior:
Commands that did not generate the bad behavior:
Pylint output
Output for the bad case:
No errors were output for the good cases.
Expected behavior
My expectations are that the same results should be generated, regardless of what form is used to get to that file.
Pylint version
OS / Environment
Win10
The text was updated successfully, but these errors were encountered: