Fix copyright header test on backup files #340

Merged
merged 3 commits into from May 12, 2016

Conversation

Projects
None yet
3 participants
@jakobj
Contributor

jakobj commented May 11, 2016

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.

+ '#.*',
+ '.*~',
+]
+exclude_file_regex = [re.compile(pattern) for pattern in exclude_file_patterns]

This comment has been minimized.

@heplesser

heplesser May 11, 2016

Contributor

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.

@heplesser

heplesser May 11, 2016

Contributor

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.

This comment has been minimized.

@jakobj

jakobj May 11, 2016

Contributor

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.

@jakobj

jakobj May 11, 2016

Contributor

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.

This comment has been minimized.

@jougs

jougs May 11, 2016

Contributor

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?

@jougs

jougs May 11, 2016

Contributor

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?

This comment has been minimized.

@heplesser

heplesser May 12, 2016

Contributor

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.

@heplesser

heplesser May 12, 2016

Contributor

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.

@heplesser

This comment has been minimized.

Show comment
Hide comment
@heplesser

heplesser May 12, 2016

Contributor

@jakobj Would you pull recent changes from master into this PR, so that the PEP8 check passes? Once Travis is happy, you have my 👍.

Contributor

heplesser commented May 12, 2016

@jakobj Would you pull recent changes from master into this PR, so that the PEP8 check passes? Once Travis is happy, you have my 👍.

@jakobj

This comment has been minimized.

Show comment
Hide comment
@jakobj

jakobj May 12, 2016

Contributor

I now added .bak to the excluded patterns, but left them separately. I hope that is fine. @jougs if you're also happy, please consider the thumbs up. :)

Contributor

jakobj commented May 12, 2016

I now added .bak to the excluded patterns, but left them separately. I hope that is fine. @jougs if you're also happy, please consider the thumbs up. :)

@jougs

This comment has been minimized.

Show comment
Hide comment
@jougs

jougs May 12, 2016

Contributor

The new code looks very nice to me. 👍 from me. Thanks for taking care!

Contributor

jougs commented May 12, 2016

The new code looks very nice to me. 👍 from me. Thanks for taking care!

@heplesser heplesser merged commit dc5edb5 into nest:master May 12, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@steffengraber steffengraber referenced this pull request in steffengraber/nest-simulator May 20, 2016

Merged

Help build #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment