-
-
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
[spelling checker] Use a context manager to access the private dict #6493
[spelling checker] Use a context manager to access the private dict #6493
Conversation
Pull Request Test Coverage Report for Build 2264351021
π - Coveralls |
pylint/checkers/spelling.py
Outdated
self.private_dict_path: str = os.path.expanduser( | ||
self.linter.config.spelling_private_dict_file | ||
) |
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.
Safe to do because:
>>> import os
>>> os.path.expanduser("")
''
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.
Is there a direct need for self.private_dict_path
? It seems like we could use self.linter.config.spelling_private_dict_file
directly. The only difficulty is that we would need to do os.path.expanduser
when loading the argument. So we would need a new argument type (probably called path
).
pylint/checkers/spelling.py
Outdated
@@ -267,10 +267,15 @@ class SpellingChecker(BaseTokenChecker): | |||
), | |||
) | |||
|
|||
def __init__(self, linter: PyLinter): |
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.
def __init__(self, linter: PyLinter): | |
def __init__(self, linter: PyLinter) -> None: |
Having a generic path option that would make ALL options using a path, expand the user path correctly would be a huge win for pylint. There's 7 expandusers call in the codebase, but probably a lot of option where we do not support this yet. |
Shouldn't be too difficult to create a new transformer. Do you want to look into this? |
Sure. Regarding the other comment, using the configuration make for rather long unreadable variable name |
Hm, on the other hand decoupling a setting from the actual underlying setting could create other problems down the line. What if we have the per directory configuration enabled and the underlying |
b770192
to
b067fee
Compare
Type of Changes
Description
Follow-up to #6491, before #6137