ctubbsii commented on a change in pull request #340: Cleanup Python and Ansible
Code
URL: https://github.com/apache/fluo-muchos/pull/340#discussion_r409282613
##########
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:
Mainly, I don't think shellcheck will be able to evaluate the quoted arg to
bash at all. So, a separate script could help it evaluate.
Alternatively... you could do something clever inside this single script,
and have it behave differently depending on the args:
```bash
function main() {
# ... do main stuff
for file in files; do
"$0" checkEOF "$file"
done
}
function checkEOF() {
local filetocheck; filetocheck=$1
# ... check file
}
if [[ $1 == 'main' ]]; then
shift
main "$@"
else if [[ $1 == 'checkEOF' ]]; then
shift
checkEOF "$@"
else
usage
fi
```
The above is just a quick mockup.
----------------------------------------------------------------
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