-
Notifications
You must be signed in to change notification settings - Fork 216
use checker_state in trailing whitespace style check + add dedicated test #2160
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
Conversation
| # keep track of name of last parameter that was defined | ||
| param_def = PARAM_DEF_REGEX.search(line) | ||
| if param_def: | ||
| checker_state['eb_last_key'] = param_def.group('key') |
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 is nice!
| comment_re = re.compile(r'^\s*#') | ||
| if comment_re.match(physical_line): | ||
| # apparently this is not the same as physical_line line?! | ||
| line = lines[line_number-1] |
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.
why switch?
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.
Because apparently this is not the same as physical_line... I noticed that for the description = line, only the part after the = was included in physical_line...
test/framework/style.py
Outdated
| ({}, None), | ||
| ({'eb_last_key': 'description'}, None), | ||
| ({'eb_last_key': 'description'}, None), | ||
| ({'eb_last_key': 'description'}, (21, "W299 trailing whitespace")), |
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 should change this, I should be specifying the state manually, but just use state = {} before the loop and then pass in state without touching it in the test.
|
Thanks for the review @wpoely86! |
@wpoely86 While working on additional style check for the order of easyconfig parameters, I noticed that we're not using the
checker_statethatpep8supports, which comes in useful in the check for trailing whitespace where we want to ignore trailing whitespace in thedescription...