-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make pylint and yapf happy with test_xsrftool.py. * Make pylint and yapf happy with test_searcher.py. * Update lint tool. * Add partial linting to Travis tests. * leave TODOs alone * add comment on separate yapf and pylint lists * Run lint tool under Python 2. * Add python-setuptools to Travis install step. Seems to be required with the older version of Python 2.7. * Revert "Add python-setuptools to Travis install step." This reverts commit c6360b4. It didn't help. * Add lint script to tools/all_tests. * Run style checks first for Travis. * Try updating setuptools. Suggested here for someone else with a similar (or identical) problem: pylint-dev/astroid#358 (comment) * Use pylint 1.9.2, because it supports Python 2.
- Loading branch information
Showing
6 changed files
with
92 additions
and
48 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,38 @@ | ||
#!/bin/sh | ||
|
||
# use pylint to check the args. | ||
# requires installing pylint http://www.logilab.org/project/pylint | ||
# short form: easy_install pylint (may require root) | ||
LINT=$(which pylint) | ||
REPORTS="no" | ||
DEPRECATED=regsub,string,TERMIOS,Bastion,rexec | ||
if [ -z "$LINT" ]; then | ||
echo "pylint not found, please install." | ||
exit 1 | ||
fi | ||
#!/bin/bash | ||
|
||
pushd "$(dirname $0)" >/dev/null && source common.sh && popd >/dev/null | ||
${LINT} --deprecated-module=${DEPRECATED} --reports=${REPORTS} "$@" | ||
|
||
# yapf can fix things automatically, but pylint is more thorough. I expect the | ||
# set of things yapf is happy with will grow faster than the set of things | ||
# pylint is happy with, so we separate these lists. | ||
DEFAULT_YAPF_FILES="tests/test_searcher.py \ | ||
tests/test_xsrftool.py" | ||
DEFAULT_PYLINT_FILES="tests/test_searcher.py \ | ||
tests/test_xsrftool.py" | ||
|
||
# Call through python -m instead of directly, so that you're sure to be able to | ||
# use it even if you installed the tools through pip. | ||
YAPF="python -m yapf --style google" | ||
# pylint will complain about TODOs, so disable that with "--disable fixme" | ||
PYLINT="python -m pylint --disable fixme" | ||
|
||
command="$1" | ||
file_list="${@:2:999}" | ||
|
||
if [ "$file_list" == "" ]; then | ||
if [ "$command" == "yapf-fix" -o "$command" == "yapf-check" ]; then | ||
file_list=$DEFAULT_YAPF_FILES | ||
elif [ "$command" == "pylint-check" ]; then | ||
file_list=$DEFAULT_PYLINT_FILES | ||
fi | ||
fi | ||
|
||
if [ "$command" == "yapf-fix" ]; then | ||
$YAPF -i $file_list | ||
elif [ "$command" == "yapf-check" ]; then | ||
$YAPF -d $file_list | ||
elif [ "$command" == "pylint-check" ]; then | ||
$PYLINT $file_list | ||
else | ||
echo "Usage: tools/lint [yapf-fix|yapf-check|pylint-check]" | ||
fi |
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