-
Notifications
You must be signed in to change notification settings - Fork 8
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
String modes #22
String modes #22
Conversation
cc @agamdua |
elif strict_mode == 'file': | ||
return True | ||
else: | ||
msg = 'Strict mode {} is not supportec'.format(strict_mode) |
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.
supported
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.
We should probably handle this check much earlier on and expect to get a valid option by this point. Suggestion would be a check in main.py
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.
Its already checked in main.py
. This is just in case..
sorry for the typo. will fix
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 it's already checked in main.py, then there's absolutely no possible way this else condition could ever be executed accidentally.
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.
the only possibility is if someone is using the Python API directly. not sure if that is likely. remove else
?
@gregarmer I think I addressed both comment in miki725@42a9e31. Let me know what you think.
|
@@ -167,7 +200,8 @@ def process(self): | |||
matches = FLAKE8_LINE.match(violation) | |||
if matches: | |||
violation_details = matches.groupdict() | |||
if violation_details['line_number'] in violated_lines: | |||
if self.should_include_violation(violation_details, |
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.
This should also be renamed to _should_include_violation()
@miki725 there's just one method rename left, then we can merge this. |
thanks @gregarmer for reminder. just updated |
flake8 can be fooled. for example:
technically there is now a violation on
Bar
since there are too many blank lines however flake8-diff will not detect it since the diff only added the blank lines which is not where violation is.The idea of strict modes is to allow to choose how files are evaluated.
only_lines
- default and existing behaviour which only counts violations when that specific line is added and it has a violationfile
- uses all violations from any modified files in the diffpossible strict modes for the future
percent_file
- uses all violations from any modified files when specific percent of lines was modified in the file. for example if only 2 lines were modified in 1000 line file, dont bother, but on the other hand if 600 lines were modified, then probably a good idea to lint the whole file, same asfile
strict mode