chilly-tailor-75063
11/02/2022, 7:32 PM[tool.pylint]
rcfile = ?
bitter-ability-32190
11/02/2022, 7:34 PMpylint
one? 👀
Pants has https://www.pantsbuild.org/docs/reference-pylint#configchilly-tailor-75063
11/02/2022, 7:35 PMbitter-ability-32190
11/02/2022, 7:35 PMhundreds-father-404
11/02/2022, 7:38 PMconfig_discovery
, Pants should be autodetecting pyproject.toml for you! https://www.pantsbuild.org/docs/reference-pylint#config_discovery
If not, there may be a bug?hundreds-father-404
11/02/2022, 7:39 PMrcfile
and have pyproject.toml
tell Pylint to use that file? How come not put the config in pyproject.toml?chilly-tailor-75063
11/02/2022, 7:41 PMpyproject.tom
file [tool.pylint] section reference the .pylintrc file. I thought about putting the configuration right in the .toml file, but I inherited it from someone and it’s pretty large.bitter-ability-32190
11/02/2022, 7:41 PMchilly-tailor-75063
11/02/2022, 7:42 PMhundreds-father-404
11/02/2022, 7:43 PM--config
option is the way to go 🙂 We generally encourage when adopting Pants trying to separate out PRs to improve the repo from PRs to adopt Pants itself. And we tried to design Pants to be flexible to support that, that you don't have to rewrite or rearchitect your whole repochilly-tailor-75063
11/02/2022, 7:45 PMchilly-tailor-75063
11/02/2022, 7:53 PMpyproject.toml
file:
[tool.pylint]
pylint-config = "/config/.pylintrc"
:)hundreds-father-404
11/02/2022, 7:54 PM[pylint].config
in pants.toml
?chilly-tailor-75063
11/02/2022, 8:02 PMhundreds-father-404
11/02/2022, 8:04 PM--config
. The file needs to also be included in the "execution sandbox" (tmpdir).
I thought that this would fail because /config/.pylintrc
isn't being included. But I guess config discovery is including both pyproject.toml
and the .pylintrc
fileshundreds-father-404
11/02/2022, 8:04 PM./pants lint ::
? Could you try running ./pants lint path/to/file.py
on a file that is not underneath the config/
folder?chilly-tailor-75063
11/02/2022, 8:12 PM./pants lint project/app/main.py
gives me these results:
16:10:51.72 [INFO] Completed: Format with isort - isort made no changes.
16:10:51.81 [WARN] Completed: Format with Black - black made changes.
project/app/main.py
16:10:52.45 [ERROR] Completed: Lint using Pylint - pylint failed (exit code 2).
************* Module project.app.main
project/app/main.py:11:0: E0401: Unable to import 'project.app.auth.router' (import-error)
project/app/main.py:12:0: E0401: Unable to import 'project.app.users.router' (import-error)
------------------------------------------------------------------
Your code has been rated at 4.44/10 (previous run: 4.44/10, +0.00)
✕ black failed.
✓ isort succeeded.
✕ pylint failed.
Which looks like it did the right thing to me.
This is with only:
[tool.pylint]
pylint-config = "/config/.pylintrc"
in the `pyproject.toml`file.chilly-tailor-75063
11/02/2022, 8:12 PMhundreds-father-404
11/02/2022, 8:18 PMchilly-tailor-75063
11/02/2022, 8:23 PMhundreds-father-404
11/02/2022, 8:50 PMls
inside that folder to make sure the files are therechilly-tailor-75063
11/02/2022, 8:53 PM/private….
path.bitter-ability-32190
11/02/2022, 8:53 PMchilly-tailor-75063
11/02/2022, 8:54 PMchilly-tailor-75063
11/02/2022, 8:54 PM