You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! First of all, congrats on the v2 release. Really excited about the project!
Is there currently any way to exclude certain files from being processed?
We have a bunch of auto-generated Alembic migration files,
that we have no intention of fixing/linting.
The closest I saw to this feature is #354,
but I wouldn't want to edit those files in any way
(i.e. add a marker on top).
Instead I'd prefer to pass a glob string as an option
(either in CLI or in config file -
e.g. --exclude '**/alembic/versions/**')
to either lint or fix commands.
The text was updated successfully, but these errors were encountered:
As a CLI flag, this is simple: we can pass an exclude kwarg to trailrunner.walk(...) to apply excludes when walking. This would be a relatively straightforward PR adding an appropriate exclude_paths value to the Options dataclass and then passing that to trailrunner.
Providing this from a config file will be a bit more tricky, since we would need to materialize configs for each candidate path before we can exclude them, and that normally only happens in fixit_file after we already have spawned child processes. It might be useful instead to move towards materializing configs in fixit_paths based on the parent directory, use that when walking to exclude paths, and then pass those configs through to fixit_file.
This would also have the benefit of frontloading disk access, allow more caching of config objects, and give us access to the materialized set of lint rules for each file in the main process, which would enable work for #321 to preform warmup before spawning child processes.
It would also be really cool if the linter could skip over a file if there are no rules enable for a given file. Currently it seems all files are visited regardless of if a rule is enabled or not!
We’re eagerly awaiting this feature, so I’d love to help push it forward! Would you be open to a PR for the CLI flag implementation? I could help with adding the exclude_paths value to the Options dataclass and passing it to trailrunner. For the configuration file part, I understand it’s a bit more complex, but I’m happy to discuss and contribute if needed.
Hello! First of all, congrats on the v2 release. Really excited about the project!
Is there currently any way to exclude certain files from being processed?
We have a bunch of auto-generated Alembic migration files,
that we have no intention of fixing/linting.
The closest I saw to this feature is #354,
but I wouldn't want to edit those files in any way
(i.e. add a marker on top).
Instead I'd prefer to pass a glob string as an option
(either in CLI or in config file -
e.g.
--exclude '**/alembic/versions/**'
)to either
lint
orfix
commands.The text was updated successfully, but these errors were encountered: