isort icon indicating copy to clipboard operation
isort copied to clipboard

option to report lines with incorrectly ordered imports

Open jayvdb opened this issue 9 years ago • 2 comments

--check only says the file is incorrect, and --diff provides the details in a format that isnt suitable for most users.

It would be good to only output a list of errors like: <line number>: import x should be in section y

This output format would be very helpful for flake8-isort

From a quick look at the parser, that isnt easily possible. However it would be might be possible to import a diff reader to transform the diff to nice error messages at least saying <line number>: import x not sorted correctly.

jayvdb avatar Apr 12 '16 16:04 jayvdb

Would implementing this feature now being easier after 5.0? It's still desired to have a compact line based output and it would ease IDE integrations.

eht16 avatar Jul 05 '20 12:07 eht16

It likely would be a bit easier, but the more I've contemplated this, the more I believe it's against the idea of formatters in general. This is the likely the same reason black doesn't offer such functionality as an example. In essence, formatters are not based on errors they are based on this AST->string output. Trying to catch the errors within that process, feels like doubling the work and complexity. But, I'd love to be proven wrong here.

timothycrosley avatar Jul 16 '20 05:07 timothycrosley