-
Notifications
You must be signed in to change notification settings - Fork 94
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 syntax for array access in cylc check-software #3032
Merged
matthewrmshin
merged 1 commit into
cylc:master
from
kinow:fix-check-software-syntax-error
Mar 28, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not a problem of this change.
The
outfile
setting here is a bit awkward. The normal interface looks likeout, err = proc.communicate()
, so I guess we are looking for0
or1
for index here? So we are expectingoutfile
to be1
(for STDOUT) or2
(for STDERR)?Just not very clear unless you know
subprocess.Popen
very well.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 that's a bit hard to understand.
git blame
says most recently touched by Martin's bandit changes, but the construct dates back to before that, so perhaps @sadielbartholomew can 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.
(But I guess the actual bug here was introduced by @MartinRyan (and missed by our reviews - sorry).
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.
@matthewrmshin
+1, I re-read the code a few times to try to understand what it was doing. Then had to open the docstring of
communicate
Yup. But we will miss more small issues like this. But as long as we can cover code like this with simple tests, we should be good 😬
Should I create a separate, low priority ticket, to review the way we are handling Popen, communicate, and accessing the array response in this method? Or would it be best to address that here now? I'd prefer to first fix this syntax issue, and later see how to simplify this code.
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'm pretty sure this is a one-off unusual use of Popen (plus @MartinRyan has recently wrapped Popen to assuage bandit, so there are few distinct calls now - all go via the wrapper). So yeah, just fix this syntax issue I'd say.
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.
Sorry, I missed this namecheck until now.
I'll be honest, I do not have much more understanding of the motivator & context behind the
outfile
setting, as I based a lot of my code forcheck-software
on that written by @oliver-sanders forrose check-software
, & though I will have understood it superficially, I recall I struggled to comprehend what the numericaloutfile
-based index was doing too (but left it in because it worked 😁 ). Perhaps Oliver can comment further?