From d19bb08bef6fcea5b9a2610f49791dd07ad5fed2 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Wed, 5 Feb 2025 15:12:26 -0600 Subject: [PATCH] ci/lint: disable isort checks The error message is completely incomprehensible and also inconsistent about whether it wants two newlines or just one after an import. Consider this python script: import sys sys.stdout.write("garbage") That passes the ruff isort check just fine. But this does not: import sys def fake_function(): sys.stdout.write("garbage") fake_function() This will fail. Why? Because there should be two newlines after imports but only for functions. This is because of PEP8 rules about blank lines, but this is not explained or referenced anywhere in output from the lint. You only get a cryptic "Import block is un-sorted or un-formatted" with some visual that isn't clear in what it's trying to communicate. Additionally, it seems to go a bit beyond PEP8 and also will fail if you have too many blank lines (i.e. more than 1) in certain cases if the succeeding line isn't a function or class definition. Furthermore consider this example: import os import sys from subprocess import check_output, DEVNULL This also fails the lint. Why? Because DEVNULL should come before check_output. Again, the lint doesn't explain this and you're left guessing what horrible formatting sin you committed. Considering the amount of time I wasted trying to even understand this and I still don't, just delete it. How are contributors supposed to understand what this lint wants when the project's own developers were confused by it. Please just alphabetically sort your python imports and don't do "from foo import *". --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d370f5cd4a..ab8ad53a73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,6 @@ line-length = 100 select = [ "F", # pyflakes "E", "W", # pycodestyle - "I", # pycodestyle "N", # pep8-naming "UP", # pyupgrade "A", # flake8-builtins