-
Notifications
You must be signed in to change notification settings - Fork 102
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
Regex match vs search #254
Comments
I think we can alternatively be smart for backwards compat until we can break it and issue deprecation log warnings until that expected release while giving folks an additional option to allow them to try the new behaviour |
Good catch, I agree with the suggestion to standardize on Wrt deprecation strategy:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This general option will allow users to choose between regex match (=default) and search semantics. This commit only implements the config option, not the actual regex semantics switching within rules. Relates to #254
- Adds a new Deprecration class that allows for a global approach to various deprecation scenarios. - The new Deprecation.get_regex_method function deals specifically with the general.regex-style-search option and behavior. - Updated rules that use Deprecation.get_regex_method: IgnoreByTitle, IgnoreByBody, IgnoreBodyLines, IgnoreByAuthorName, AuthorValidEmail Relates to #254
This general option will allow users to choose between regex match (=default) and search semantics. This commit only implements the config option, not the actual regex semantics switching within rules. Relates to #254
- Adds a new Deprecration class that allows for a global approach to various deprecation scenarios. - The new Deprecation.get_regex_method function deals specifically with the general.regex-style-search option and behavior. - Updated rules that use Deprecation.get_regex_method: IgnoreByTitle, IgnoreByBody, IgnoreBodyLines, IgnoreByAuthorName, AuthorValidEmail Relates to #254
This was implemented in #345 which will go out with 0.18.0 soonish. Implemented behavior:
The |
- Python 3.11 support - Last release to support Python 3.6 - Behavior Change: In a future release, gitlint will be switching to use `re.search` instead of `re.match` semantics for all rules. (#254) - gitlint no longer uses the `sh` library by default in an attempt to reduce external dependencies. - `--commits` now also accepts a comma-separated list of commit hashes, making it possible to lint a list of non-contiguous commits without invoking gitlint multiple times (#283) - Improved handling of branches that have no commits (#188) - Support for `GITLINT_CONFIG` env variable (#189) - Added a new `gitlint-ci` pre-commit hook, making it easier to run gitlint through pre-commit in CI (#191) - Contrib Rules: - New `contrib-disallow-cleanup-commits` rule (#312) - New `contrib-allowed-authors` rule (#358) - User Defined rules: - Gitlint now recognizes `fixup=amend` commits, available as `commit.is_fixup_amend_commit=True` - Gitlint now parses diff **stat** information, available in `commit.changed_files_stats` (#314) - Bugfixes: - Use correct encoding when using `--msg-filename` parameter (#310) - Various documentation fixes (#244) (#263) (#266) (#294) (#295) (#347) (#364) - Under-the-hood: - Dependencies updated - Moved to blacked for formatting - Fixed nasty CI issue (#298) - Unit tests fix (#256) - Vagrant box removed in favor of github dev containers (#348) - Removed a few lingering references to the `master` branch in favor of `main` - Moved roadmap and project planning to github projects Full Release details in CHANGELOG.md.
Released as part of 0.18.0, closing! |
The ignore-body-lines regex also works for re.search(). Resolving the warning by opt-in to the new behavior. Relevant links: - https://jorisroovers.com/gitlint/configuration/#regex-style-search - jorisroovers/gitlint#254
The ignore-body-lines regex also works for re.search(). Resolving the warning by opting-in to the new behavior. Relevant links: - https://jorisroovers.com/gitlint/configuration/#regex-style-search - jorisroovers/gitlint#254
The ignore-body-lines regex also works for re.search(). Resolving the warning by opting-in to the new behavior. Relevant links: - https://jorisroovers.com/gitlint/configuration/#regex-style-search - jorisroovers/gitlint#254
This will make all rules use re.search() by default. It's still possible to manually reverse this behavior by setting: general.regex-style-search=False Relates to #254
This will make all rules use re.search() by default. It's still possible to manually reverse this behavior by setting: general.regex-style-search=False Relates to #254
Some rules' regular expressions are used with
.search
, some with.match
, and the only source which one it is appears to be the gitlint source.search: title-match-regex, body-match-regex
match: author-valid-email, ignore-by-title, ignore-by-body, ignore-body-lines, ignore-by-author-name
I think it would be good to standardize on just one of these for all regex matching. I suggest going with
.search
, because.match
is a Python oddity not present in any other language I know of. (It's kind of ironic and unfortunate that the rules that havematch
in their name are the ones for which we do not invoke match, but search.)Then again, standardizing on one would be a breaking change. If that's not acceptable or will take some time, I think we should document which method is used with each rule. I'm available to help with that or making the search/match change (if we're going with search ;)), let me know.
The text was updated successfully, but these errors were encountered: