Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default config does not report diffs, even though --diff appears to be executed #90

Open
elliot-100 opened this issue May 22, 2024 · 1 comment

Comments

@elliot-100
Copy link

Docs: https://pycqa.github.io/isort/docs/configuration/github_action.html and https://github.com/isort/isort-action/blob/master/README.md say:

isort configuration options to pass to the isort CLI. Defaults to --check-only --diff.

Expected behaviour:

Output including diffs, similar to what I get running isort --check-only --diff . at CLI, e.g.

isort --check-only --diff .
ERROR: C:\Users\[REDACTED]\code\elliot-100_Spond\tests\test_spond.py Imports are incorrectly sorted and/or formatted.
--- C:\Users\[REDACTED]\code\elliot-100_Spond\tests\test_spond.py:before        2024-05-22 10:26:37.165779
+++ C:\Users\[REDACTED]\code\elliot-100_Spond\tests\test_spond.py:after 2024-05-22 10:59:23.726940
@@ -1,7 +1,6 @@
 """Test suite for Spond class."""
 
 import pytest
-
 
 from spond.spond import Spond
 
Skipped 2 files

Actual behaviour:

Output does not include diffs. Extract from GitHub actions log. Note --diff does appear:

Running isort --check-only --diff .
Error: ERROR: /home/runner/work/Spond/Spond/tests/test_spond.py Imports are incorrectly sorted and/or formatted.
Error: Process completed with exit code 1.

i.e. similar to output I get on running without the --diff flag at CLI:

isort  --check-only .
ERROR: C:\Users\[REDACTED]\code\elliot-100_Spond\tests\test_spond.py Imports are incorrectly sorted and/or formatted.
Skipped 2 files

Please let me know if any extra information is required.

@elliot-100
Copy link
Author

After discussion at #72 :

Workaround:

Don't use official isort GitHub action, use command line interface, e.g:

steps:
  - name: Lint imports with isort
    # No modifications; exit with error if the code is not properly formatted; show diffs
    run: isort . --check-only --diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant