ctubbsii commented on a change in pull request #340: Cleanup Python and Ansible 
Code
URL: https://github.com/apache/fluo-muchos/pull/340#discussion_r409250208
 
 

 ##########
 File path: scripts/cibuild.sh
 ##########
 @@ -0,0 +1,12 @@
+set -e
+echo "Running nose tests"
+nosetests -w lib/
+echo "Running Ansible-lint"
+ansible-lint -x 204,301
+echo "Ansible-lint returned OK"
+echo "Running flake8 to check Python code"
+flake8
+echo "flake8 returned OK"
+echo "Checking for files which have no newline at end of file"
+git ls-files | tr '\n' '\0' | xargs -0 -L1 bash -c 'if test "$(grep 
--files-with-matches --binary-files=without-match --max-count=1 --regexp='.*' 
"$0")" && test "$(tail --bytes=1 "$0")"; then echo "No new line at end of $0."; 
false; fi'
 
 Review comment:
   This quoting doesn't look quite correct, because it uses single quotes 
around the arg to bash, but then uses a single quote inside that around that 
for the `--regexp='.*'`
   
   It'd probably be better to put this in a separate script, and have `xargs` 
execute it directly as:
   
   ```suggestion
   git ls-files | tr '\n' '\0' | xargs -0 -L1 /usr/bin/bash "$(dirname 
"$0")/checkMissingEOF"
   ```
   
   Also, not sure what the difference between `-L1` and `-n1` is here. I've 
never used `-L` with xargs.
   
   In any case, whatever scripts you create should pass through `shellcheck`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to