pyrefly
pyrefly copied to clipboard
Feature Request: Match list of globs in sub-config
Summary
It would be really nice if match supported a list of globs to match against within a sub-config
Example:
# disable "implicit-any" for paths that haven't been fixed yet.
[[sub-config]]
matches = [
"sub/project/tests/file.py",
"sub/project/foobar/**",
"src/py/experimental/**",
]
[sub-config.errors]
implicit-any = false
Comparison to MyPy
mypy supports multiple modules within an override table:
# pyproject.toml
[tool.mypy]
strict_optional = true
[[tool.mypy.overrides]]
strict_optional = false
module = [
# go/keep-sorted start
"pkg1.auth", # src/pkg1/auth.py
"pkg1.backend",
"pkg1.client", # but the rest of "package/" uses strict_optional = true
"pkg2.analysis.adaptive_fitting",
"pkg2.analysis.adaptive_fitting_test",
"pkg2.analysis.analog_modeling.analog_bare_finders",
"pkg2.analysis.analog_modeling.spin_Hamiltonian_conversion",
# ...
# ~800 total python modules 😭
]
In order to do the same thing within pyrefly, it would look like[^1]:
[[tool.pyrefly.sub-config]]
match = "src/pkg1/auth.py" # pkg1.auth
[tool.pyrefly.sub-config.errors]
implicit-any = false
[[tool.pyrefly.sub-config]]
# a different file, but we can't glob `src/labrad/** because src/pkg1/foo.py
# and many more do use implicit-any
match = "src/pkg1/backend.py"
[tool.pyrefly.sub-config.errors]
implicit-any = false
# repeat ~800 times.
[^1]: Unless I'm missing some option. If so, please LMK!
https://github.com/kavix/pyrefly
Support multiple glob patterns in sub-config matches