summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2019-11-09 23:36:53 -0800
committerTimothy Crosley <timothy.crosley@gmail.com>2019-11-09 23:36:53 -0800
commit4de01f5b1b98dca14fc4192fba7196cd4702d458 (patch)
treea3a1d53b8912884a3527e9b88006f6db1ff0baef
parent6209700b5dbc41735ce433047e1ecadd0ce46961 (diff)
downloadisort-4de01f5b1b98dca14fc4192fba7196cd4702d458.tar.gz
Fix --diff command-line option
-rw-r--r--isort/main.py17
-rwxr-xr-xscripts/clean.sh2
-rwxr-xr-xscripts/lint.sh2
3 files changed, 16 insertions, 5 deletions
diff --git a/isort/main.py b/isort/main.py
index 000b4748..4447545e 100644
--- a/isort/main.py
+++ b/isort/main.py
@@ -32,6 +32,7 @@ Try one of the following:
Visit https://timothycrosley.github.io/isort/ for complete information about how to use isort.
"""
+
def is_python_file(path: str) -> bool:
_root, ext = os.path.splitext(path)
if ext in (".py", ".pyi"):
@@ -581,12 +582,12 @@ def main(argv: Optional[Sequence[str]] = None) -> None:
arguments["settings_path"] = os.path.dirname(arguments["settings_path"])
config_dict = arguments.copy()
- config_dict.pop("recursive", False)
ask_to_apply = config_dict.pop("ask_to_apply", False)
jobs = config_dict.pop("jobs", ())
show_logo = config_dict.pop("show_logo", False)
filter_files = config_dict.pop("filter_files", False)
check = config_dict.pop("check", False)
+ show_diff = config_dict.pop("show_diff", False)
config = Config(**config_dict)
wrong_sorted_files = False
@@ -612,14 +613,24 @@ def main(argv: Optional[Sequence[str]] = None) -> None:
executor = multiprocessing.Pool(jobs)
attempt_iterator = executor.imap(
functools.partial(
- sort_imports, check=check, ask_to_apply=ask_to_apply, **config_dict
+ sort_imports,
+ check=check,
+ ask_to_apply=ask_to_apply,
+ show_diff=show_diff,
+ **config_dict,
),
file_names,
)
else:
# https://github.com/python/typeshed/pull/2814
attempt_iterator = ( # type: ignore
- sort_imports(file_name, check=check, ask_to_apply=ask_to_apply, **config_dict)
+ sort_imports(
+ file_name,
+ check=check,
+ ask_to_apply=ask_to_apply,
+ show_diff=show_diff,
+ **config_dict,
+ )
for file_name in file_names
)
diff --git a/scripts/clean.sh b/scripts/clean.sh
index 45e5688c..1a5b493e 100755
--- a/scripts/clean.sh
+++ b/scripts/clean.sh
@@ -1,5 +1,5 @@
#!/bin/bash
set -euxo pipefail
-poetry run isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --use-parentheses --line-width=100 --recursive isort/ tests/
+poetry run isort --profile hug isort/ tests/
poetry run black isort/ tests/ -l 100
diff --git a/scripts/lint.sh b/scripts/lint.sh
index 2198495d..d31f426c 100755
--- a/scripts/lint.sh
+++ b/scripts/lint.sh
@@ -5,7 +5,7 @@ set -euxo pipefail
poetry run cruft check
poetry run mypy --ignore-missing-imports isort/
poetry run black --check -l 100 isort/ tests/
-# poetry run isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --use-parentheses --line-width=100 --recursive --check --diff --recursive isort/ tests/
+poetry run isort --profile hug --check --diff isort/ tests/
poetry run flake8 isort/ tests/ --max-line 100 --ignore F403,F401,W503,E203
poetry run safety check
poetry run bandit -r isort/