Created
January 5, 2017 09:17
-
-
Save mbukatov/d9ae7f3be20f4aebdfc93cc75a776713 to your computer and use it in GitHub Desktop.
search for missing ending newlines
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
$ find . -type f | egrep -v '\.(tox|env|git|egg-info)' | egrep -v '(pyc|png|gz)$' | xargs -n 1 ./check-last-newline.sh 2>/dev/null # sed 's/.*\.\(.*\)$/\1/' | sort | uniq | |
./alerting/tendrl/alerting/tests/README.rst | |
./alerting/etc/tendrl_definitions_performance_monitoring.yaml | |
./alerting/.travis.yml | |
./node_agent/tendrl/node_agent/tests/test_configure_uuid.sample | |
./node_agent/tendrl/node_agent/tests/README.rst | |
./node_agent/.travis.yml | |
./node_agent/tendrl-noded.service | |
./tendrl-site/source/javascripts/vendor/jquery.backstretch.min.js | |
./tendrl-site/source/javascripts/vendor/codemirror.js | |
./tendrl-site/data/docs.yml | |
./ceph_bridge/tendrl/ceph_integration/tests/gravel1.rockery_services.json | |
./ceph_bridge/tendrl/ceph_integration/tests/osd_map_1_removed.json | |
./ceph_bridge/tendrl/ceph_integration/tests/mds1_services.json | |
./ceph_bridge/tendrl/ceph_integration/tests/mds_map_1_removed.json | |
./ceph_bridge/tendrl/ceph_integration/tests/mon_map.json | |
./ceph_bridge/tendrl/ceph_integration/tests/mds2_services.json | |
./ceph_bridge/tendrl/ceph_integration/tests/mon_map_1_removed.json | |
./ceph_bridge/tendrl/ceph_integration/tests/osd_map.json | |
./ceph_bridge/tendrl/ceph_integration/tests/osd_map_migrated.json | |
./ceph_bridge/tendrl/ceph_integration/tests/gravel1.rockery_services_migrated.json | |
./ceph_bridge/tendrl/ceph_integration/tests/README.rst | |
./ceph_bridge/tendrl/ceph_integration/tests/gravel2.rockery_services.json | |
./ceph_bridge/tendrl/ceph_integration/manager/tendrl_definitions_ceph.py | |
./ceph_bridge/etc/tendrl_definitions_ceph_integration.yaml | |
./ceph_bridge/.travis.yml | |
./gluster_bridge/tendrl/gluster_integration/tests/README.rst | |
./gluster_bridge/.travis.yml | |
./tendrl/README.md | |
./common/.testrepository/times.dbm | |
./common/tendrl/common/tests/hacking/README.rst | |
./common/tendrl/common/tests/README.rst | |
./documentation/images/src/tendrl_core_components_overview.dia | |
./performance_monitoring/tendrl/performance_monitoring/tests/README.rst | |
./performance_monitoring/etc/tendrl_definitions_performance_monitoring.yaml | |
./performance_monitoring/.travis.yml | |
./tendrl-api/tendrl-apid.service |
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
#!/bin/bash | |
# report error when given file doesn't contain newline on it's last line | |
# see also: https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline | |
last_char=$(tail -c 1 "$1" | od -v -An | sed 's/^\ *//') | |
if [[ ! $last_char ]]; then | |
# file is empty, ok | |
exit 0 | |
fi | |
if [[ $last_char = "000012" ]]; then | |
exit 0 | |
else | |
echo "$1" # >&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment