Add missing utf-8 header on python files
Closed this issue · 2 comments
gforcada commented
I created a small bash script that goes over the subtree from where it runs and adds the python utf-8 header on all of them.
It would be cool if that is integrated on this distribution :)
The code:
#!/bin/bash
for f in `find . -name "*.py" -exec /usr/bin/grep -H -E -o -c "coding: utf-8" {} \; | /usr/bin/grep 0 | cut -d":" -f1`;
do
if [[ `stat -f %z ${f}` -gt 0 ]];
then
echo '# -*- coding: utf-8 -*-' > ${f}.tmp.bla
cat ${f} >> ${f}.tmp.bla
mv ${f}.tmp.bla ${f}
else
echo "${f} is empty";
fi
done
tisto commented
I'm wondering if we could integrate this as a pre-commit hook in github. Having a check on Jenkins for this is a good idea though.
gforcada commented
I left that up to you to decide, the code is there and you are completely free to do with it whatever it pleases more ;)