-
Notifications
You must be signed in to change notification settings - Fork 370
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
Fix copyright header test on backup files #340
Conversation
'#.*', | ||
'.*~', | ||
] | ||
exclude_file_regex = [re.compile(pattern) for pattern in exclude_file_patterns] |
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 think it would be more elegant to have a single regular expression using the or operator, i.e., something like \.#.*|#.*|.*~
. Maybe also add .bak
.
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.
Sure, we could do it in a single one. My thinking was that this way it might be easier to add new patterns later? Like the one you suggested.
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 agree with @jakobj that having the patterns individually helps readability. But as they are short, maybe they can all be on a single line?
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.
To quite a degree, I think, it is a matter of taste: do you want to put the iteration on the Python side or the Regex side? Since most NEST developers are much more versed in Python than in regular expressions, doing it in Python makes sense. On the other hand, I would expect that placing the iteration in a compiled regular expression object will be more efficient. But run-time efficiency is no issue here, so we should choose a coding style most developers will be familiar with.
@jakobj Would you pull recent changes from master into this PR, so that the PEP8 check passes? Once Travis is happy, you have my 👍. |
I now added |
The new code looks very nice to me. 👍 from me. Thanks for taking care! |
As mentioned in #339 the test currently fails when backup files are present. This PR introduces a regular expression match on the filename to exclude such files from the check. Fixes #339.