facebook / facebook/pyrefly

Feature Request: Match list of globs in sub-config

Open
#3,470 1 comment 2 reactions 0 assignees View on GitHub
configuration
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

# Summary

It would be really nice if `match` supported a list of globs to match against within a sub-config

## Example:

```toml
# 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:

```toml
# 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]:

```toml
[[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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.