-
-
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
Small refactor in spelling checker #6491
Small refactor in spelling checker #6491
Conversation
0320fac
to
99e5703
Compare
Pull Request Test Coverage Report for Build 2262447303
💛 - Coveralls |
if lower_cased_word not in self.unknown_words: | ||
if ( | ||
lower_cased_word not in self.unknown_words | ||
and self.private_dict_file is not None |
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.
Isn't this a change in behaviour?
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.
If self.private_dict_file is None
the write() call would crash pylint. It's never happening but you have to read the whole class workflow to realize that, and mypy can't. I'll do a follow-up refactor to initialize thing in the constructor where it should be clearer.
original_line = line | ||
try: | ||
initial_space = re.search(r"^[^\S]\s*", line).regs[0][1] | ||
# The mypy warning is caught by the except statement | ||
initial_space = re.search(r"^\s+", line).regs[0][1] # type: ignore[union-attr] |
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.
There's a simplification in the regex here on top of the mypy ignore. [^\S]
is \s
and \s\s*
is \s+
Co-authored-by: Daniël van Noord <[email protected]>
'[^\S]' is '\s' and '\s\s*' is '\s+'
Co-authored-by: Daniël van Noord <[email protected]>
67a0378
to
f12d026
Compare
Type of Changes
Description
Refactor prior to #6137