diff --git a/bin/dib-lint b/bin/dib-lint index c58865e5..a8c10d4d 100755 --- a/bin/dib-lint +++ b/bin/dib-lint @@ -83,10 +83,15 @@ for i in $(find elements -type f \ error "$i is not executable" fi - # Ensure 4 spaces indent are used - if [[ "$(file -b -k --mime-type $i)" =~ "text/x-python" ]]; then + # run flake8 over python files. note our "dib-python" + # interpreter can confuse the magic matching being done in + # "file" and make it think the file is not python; + # special-case it. + if [[ "$(file -b -k --mime-type $i)" =~ "text/x-python" ]] || \ + [[ $firstline =~ "dib-python" ]]; then flake8 $i || error "$i failed flake8" else + # Ensure 4 spaces indent are used if ! excluded indent ; then indent_regex='^\( \{4\}\)* \{1,3\}[^ ]' if grep -q "$indent_regex" ${i}; then diff --git a/elements/package-installs/bin/package-installs-v2 b/elements/package-installs/bin/package-installs-v2 index f1814dd7..b4a4d0d8 100755 --- a/elements/package-installs/bin/package-installs-v2 +++ b/elements/package-installs/bin/package-installs-v2 @@ -101,3 +101,8 @@ def main(): if __name__ == '__main__': main() + +# Tell emacs to use python-mode +# Local variables: +# mode: python +# End: