pylint unable to find imports
kbalk opened this issue · comments
I defined pylint
as a static analysis tool as shown below. When I invoke hatch fmt -l myproject
, pylint is unable to find the imports referenced by "myproject". This is due to the fact that "myproject" and the static tools use different python paths. Both have the root ~/.local/share/hatch/env/virtual/myproject/xxxxxx/
on my linux system, but under that directory is a "myproject" subdirectory and a "hatch-static-analysis" directory. The required dependencies for "myproject" are found under the "myproject" subdirectory, but not under the "hatch-static-analysis" directory where 'pylint' is invoked.
I suspect that's intentional, but I'm not sure how to work around it other than duplicating the required dependencies under the tool.hatch.envs.hatch-static-analysis dependencies list. Is there a way to solve it other than duplicating the dependencies?
[tool.hatch.envs.hatch-static-analysis]
dependencies = [
"black",
"isort",
"pylint",
]
[tool.hatch.envs.hatch-static-analysis.scripts]
format-check = [
"isort --check-only --diff {args:.'}",
"black --check --diff {args:.}",
]
format-fix = [
"isort {args:.}",
"black {args:.}",
]
lint-check = [
"pylint {args:.}",
]
lint-fix = "lint-check"