blablatdinov / ondivi

Ondivi (Only diff violations) is a Python script filtering coding violations, identified by static analysis, only for changed lines in a Git repo.
MIT License
13 stars 0 forks source link

Support black and isort #94

Closed supadrupa closed 1 month ago

supadrupa commented 1 month ago

Amazing program can you add support black --check and isort -c?

blablatdinov commented 1 month ago

@supadrupa Hi! Thanks for report!

Great idea, I'll try to implement it

blablatdinov commented 1 month ago

@supadrupa I created a PR. Unfortunately, black --check show only file names without line numbers, so "ondivi" filter out lines only by the file name

black --check output:

would reformat ondivi/__main__.py
would reformat file.py

Oh no! 💥 💔 💥
1 file would be reformatted.

black --check | ondivi output:

would reformat file.py

Oh no! 💥 💔 💥
1 file would be reformatted.

Is this what you expect?

supadrupa commented 1 month ago

@blablatdinov Yes, I think this is what is needed.

blablatdinov commented 1 month ago

@supadrupa I research the use of black and isort for modified files and found a method that does not require changes to ondivi.

You can use git diff --name-only command

black --check $(git diff --name-only) or isort -c $(git diff --name-only)

Also check flake8-black or flake8-isort tools for convert black or isort issues to flake8 format