Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve configuration of filename patterns #191

Open
dbr opened this issue Sep 29, 2020 · 1 comment
Open

Improve configuration of filename patterns #191

dbr opened this issue Sep 29, 2020 · 1 comment
Milestone

Comments

@dbr
Copy link
Owner

dbr commented Sep 29, 2020

Currently saving the config includes the complete list of regex patterns

This probably isn't too good, as most of the time people a) wont change them, or b) won't remove that option and this wont pick up improvements to the default patterns

Instead the default patterns should be moved out of the config, and instead:

  1. New option to add custom patterns.
  2. Need a way to control if these patterns are checked before or after the built-in patterns
  3. Need a way to control if the custom patterns completely replace the built-in ones or not (e.g someone might only want to match a very strict set of patterns)

Should use v4.0 to deprecate the filename_patterns option - keep respecting it for now, but emit warning that this option will be removed soon

@dbr dbr added this to the v4.0 milestone Sep 29, 2020
@dbr
Copy link
Owner Author

dbr commented May 23, 2021

Most flexible way would be to have a custom_patterns = {'pattern': '...', order: '...'} or something, but that seems a bit clunky

Instead maybe just:

  1. A custom_patterns config option, default empty, with a list of regexs
  2. A second option, something like custom_patterns_order which can be either before, after, or replace (i.e before builtins, after builtins, or replace them entirely). Default would probably be "before".

This makes it easy to just add one or two custom patterns, and either prefer them tot eh builtins, or use them as a fallback. The "replace" option would be useful to customize the pattern matching in more complex ways (or only handle a very specific set of patterns)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant