Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
lint: Run isort as a linter.
Anders Kaseorg48e55875fe69
diff --git a/.isort.cfg b/.isort.cfgindex dc8638df4f0..a58ddc8a8d4 100644--- a/.isort.cfg+++ b/.isort.cfg@@ -3,4 +3,4 @@ multi_line_output = 3known_third_party = netifacesinclude_trailing_comma = Trueuse_parentheses = True-line_length = 88+line_length = 100diff --git a/tools/lint b/tools/lintindex 2c379c83e5d..0b5801e3d36 100755--- a/tools/lint+++ b/tools/lint@@ -89,6 +89,9 @@ def run() -> None:linter_config.external_linter('gitlint', ['tools/commit-message-lint'],description="Checks commit messages for common formatting errors.""(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",# This option is dangerous in the context of runningdiff --git a/tools/run-isort b/tools/run-isortnew file mode 100755index 00000000000..016521891af--- /dev/null+++ b/tools/run-isort@@ -0,0 +1,8 @@+#!/bin/sh+set -eu+if [ "$1" = "--fix" ]; then+ shift+ exec isort "$@"+else+ exec isort --check-only --diff "$@"+fi