Various improvements to run.py #20
Open
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.
I'd recommend reviewing commit-by-commit, I tried to keep them isolated and understandable. In order:
subprocess.check_outputto passing lists tosubprocess.run. The reason is that"my_cool_app " + input_filewill break ifinput_filecontains a space or a myriad of other special chars. This can also enable vulnerabilities if e.g. a file is named|| true; rm -rf /pathlib.Pathforcwd, it's easier to do path operations and seems to be a successor foros.pathargswithPathandintandbool. Might as well rely onargparseto properly parse types.rufflinter and got it passing onrun.py. I noticed mixing 2 vs. 4 space indentation, some unused vars, etc. The linter put the code in better shape.I only got to
run.pyas some of the other files are bigger and more work. But hopefully this helps. Tested on python3.12.