brave-hair-402
03/04/2023, 3:19 PMper-file-ignores = { '__init__.py'= ["F401"]}
[tool.ruff.isort]
known-third-party = ["scipy"]
It is clear that per-file-ignores line is used by ruff when invoked through pants. For some reason it however completely ignores the known-third-party specification. If I however run ruff directly with ("ruff --config pyproject.toml --select="I") from the root it seems to use the known-third-party specification. What could be going wrong here, or is this a bug?enough-analyst-54434
03/04/2023, 3:23 PMenough-analyst-54434
03/04/2023, 3:24 PM[tool.ruff]
exactly: https://github.com/pantsbuild/pants/blob/c9def21de8a4f95d6929af227b605b3f1adfa9d2/src/python/pants/backend/python/lint/ruff/subsystem.py#L108enough-analyst-54434
03/04/2023, 3:25 PMbrave-hair-402
03/04/2023, 3:32 PM[ruff]
config="pyproject.toml"
to pants.toml?enough-analyst-54434
03/04/2023, 3:47 PMenough-analyst-54434
03/04/2023, 3:49 PMruff.toml
file quick. That should get auto discovered without the need for magic byte sequence checking based on file name alone.brave-hair-402
03/04/2023, 4:05 PMenough-analyst-54434
03/04/2023, 4:48 PMbrave-hair-402
03/04/2023, 5:45 PMbrave-hair-402
03/04/2023, 5:53 PMbrave-hair-402
03/04/2023, 5:55 PMenough-analyst-54434
03/04/2023, 6:04 PM~/dev/siggi84/pants_ruff_bug (master) $ ~/bin/ruff.venv/bin/ruff --config ruff.toml --fix src/python/hello_ruff.py src/python/hello_user.py
~/dev/siggi84/pants_ruff_bug (master) $ cd src/python/
~/dev/siggi84/pants_ruff_bug/src/python (master) $ ~/bin/ruff.venv/bin/ruff --config ../../ruff.toml --fix hello_ruff.py hello_user.py
Found 1 error(s) (1 fixed, 0 remaining).
enough-analyst-54434
03/04/2023, 6:04 PMenough-analyst-54434
03/04/2023, 6:05 PMenough-analyst-54434
03/04/2023, 6:06 PMenough-analyst-54434
03/04/2023, 6:07 PM--no-local-cache --keep-sandboxes=always
to confirm what Pants was doing and how it was doing it.enough-analyst-54434
03/04/2023, 6:10 PM$ git diff
diff --git a/ruff.toml b/ruff.toml
index d041e28..a8117a3 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -5,3 +5,5 @@ ignore = []
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "I"]
unfixable = []
+
+src = ["src/python"]
That fixes.enough-analyst-54434
03/04/2023, 6:11 PMenough-analyst-54434
03/04/2023, 6:15 PMpyproject.toml
auto-discovery is broken for cases like your original use case.brave-hair-402
03/04/2023, 6:35 PMenough-analyst-54434
03/04/2023, 6:36 PMbrave-hair-402
03/04/2023, 10:51 PMenough-analyst-54434
03/04/2023, 10:51 PMbrave-hair-402
03/04/2023, 10:53 PMenough-analyst-54434
03/04/2023, 10:55 PMbrave-hair-402
03/04/2023, 10:57 PMbusy-vase-39202
03/06/2023, 3:06 PM