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
Suppress OSError
in config file discovery
#7423
Conversation
Pull Request Test Coverage Report for Build 3000802112
💛 - Coveralls |
Coverage is same as on |
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.
Did'nt you say that t contextlib performance were worst than try/except ?
It is (marginally) I think. But since this only called once and the code became really unreadable with all the Want me to change? |
Not at all, just wanted to know your opinion :) |
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.
I have a feeling this is getting really complicated. Also we're not handling errors. Failing to yield a configuration file because of a permission error will make pylint not take a file into account for non obvious reasons so it seems like we need to do something on top of suppression the error outright.
How about we create some function with explicit name like "get all ini config file" or "search for configuration file in parent directories". That way we can launch a single function in the contextlib.suppresserror or use try/except and maybe decide later what to do easily in case of error.
In the issue you're fixing right now the reason is |
Yeah, I can refactor this into separate functions. I can also print something to |
Sounds good ! |
This comment has been minimized.
This comment has been minimized.
😅 Bit of a chicken and egg. How can we know if we are in verbose mode if we are still looking for a configuration to load... I would be okay with not doing anything. I think the annoyance of warning about this if you already know about the issue outweighs the issue of silently ignoring. |
🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉 This comment was generated for commit 3e67b1f |
towncrier create <IssueNumber>.<type>
which will beincluded in the changelog.
<type>
can be one of: new_check, removed_check, extension,false_positive, false_negative, bugfix, other, internal. If necessary you can write
details or offer examples on how the new change is supposed to work.
and preferred name in
script/.contributors_aliases.json
Type of Changes
Description
Closes #7169