-
Notifications
You must be signed in to change notification settings - Fork 60
Fixed linter errors in the Python scripts #175
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
babolivier
left a comment
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 looks great, thanks a lot! I've noticed a (small) issue with the bash command, and I've got a few other nitpicks I'd like to see addressed before I'm happy to merge this.
tools/convert.py
Outdated
| failed_files[f] = e | ||
|
|
||
| if len(failed_files) > 0: | ||
| if failed_files: |
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 prefer explicitly stating the condition we're checking here (i.e. to keep this line as it is, even though it does essentially the same thing), I find it makes the code a bit easier to read.
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 will revert this change. See FURB115 for an explanation of the lint rule.
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 at this point it comes down to personal preference. I have a tendency to favour readability over making code as succinct as it can be, maybe sometimes to a fault - not that it's necessarily a huge deal in this case.
| files=( ispdb/!(*.xml) ) | ||
| if (( ${!files[*]} )); then | ||
| for file in "${files[@]}"; do | ||
| printf '::error file=%s::File name "%s" does not end in .xml – Please rename!\n' "$file" "$file" |
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.
While we're here, we could replace this printf with echo (and remove the ::error file=%s:: bit since it's a bit redundant).
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.
It looks like the idea in 2921ddd was to use GitHub Actions annotations, so that it would annotate the problematic file.
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.
Hm, fair enough, it should probably stay then. I still think we should move away from printf to echo but I won't block on this.
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.
babolivier
left a comment
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.
lgtm, thanks again!
| files=( ispdb/!(*.xml) ) | ||
| if (( ${!files[*]} )); then | ||
| for file in "${files[@]}"; do | ||
| printf '::error file=%s::File name "%s" does not end in .xml – Please rename!\n' "$file" "$file" |
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.
Hm, fair enough, it should probably stay then. I still think we should move away from printf to echo but I won't block on this.
We could remove the dependency on lxml as well, as Python has built in XML parsing in the xml.etree.ElementTree module, which would improve CI performance.