Add isort to pre-commit - #379
Conversation
| fi | ||
|
|
||
| result=$(python -m isort -rc . | grep -v "Skipped") | ||
| if [[ $result ]] ; then |
There was a problem hiding this comment.
what do we check here?
There was a problem hiding this comment.
Checking if unordered imports aren't remained.
python -m isort -rc . also outputs diff when unordered imports remained.
To cover the case that developers don't set pre-commit and uploaded files have unordered imports. (Same to autopep8's check)
There was a problem hiding this comment.
shouldn't we check the exit code instead ($?) ?
There was a problem hiding this comment.
Your comment is exact.
I've checked its behavior at first, but unfortunately both cases(ordered, unordered) return 0.
There was a problem hiding this comment.
There was a problem hiding this comment.
Will look into again.
At least I found below issue(fixed) and codes. Sholud be returned non 0.
PyCQA/isort#423
https://github.com/timothycrosley/isort/blob/d093f97c1d26854fbb082e43cfae8a062dacda56/isort/main.py#L382
There was a problem hiding this comment.
I could do as expected by using --check-only opt for isort :)
It's to keep imports clean.