lint: Run isort as a linter.

With a change to increase the line length to 100 characters by
tabbott.

Fixes #2665.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-01-07 16:04:54 -08:00 committed by Tim Abbott
parent 365fe0b3d5
commit 48e55875fe
3 changed files with 12 additions and 1 deletions

View File

@ -3,4 +3,4 @@ multi_line_output = 3
known_third_party = netifaces known_third_party = netifaces
include_trailing_comma = True include_trailing_comma = True
use_parentheses = True use_parentheses = True
line_length = 88 line_length = 100

View File

@ -89,6 +89,9 @@ def run() -> None:
linter_config.external_linter('gitlint', ['tools/commit-message-lint'], linter_config.external_linter('gitlint', ['tools/commit-message-lint'],
description="Checks commit messages for common formatting errors." description="Checks commit messages for common formatting errors."
"(config: .gitlint)") "(config: .gitlint)")
linter_config.external_linter('isort', ['tools/run-isort'], ['py'],
description="Sorts Python import statements",
fix_arg='--fix')
semgrep_command = ["semgrep", "--config=./tools/semgrep.yml", "--error", semgrep_command = ["semgrep", "--config=./tools/semgrep.yml", "--error",
# This option is dangerous in the context of running # This option is dangerous in the context of running

8
tools/run-isort Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
set -eu
if [ "$1" = "--fix" ]; then
shift
exec isort "$@"
else
exec isort --check-only --diff "$@"
fi