Skip to content

feat(rules): add regex support for [subject|header]-full-stop rules #818

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

Closed
wants to merge 1 commit into from
Closed

Conversation

sepehr
Copy link

@sepehr sepehr commented Oct 5, 2019

Description

This allows usage of string regular expressions as value for subject-full-stop and header-full-stop rules.

Motivation and Context

We, internally, allow a range of stops. The current rule, however, allows providing one stop character which is restrictive, at least, in our use-case.

Yet, I'm not sure if it's a better fit for a plugin or the core.

Usage examples

// commitlint.config.js
module.exports = {
  rules: {
    'subject-full-stop': [2, 'always', '[\\.0-9]'],
    'header-full-stop': [2, 'always', '[\\.0-9]']
  }
};
# subject
echo "test: subject" | commitlint # fails
echo "test: subject." | commitlint # passes
echo "test: subject #42" | commitlint # passes
echo "test: subject #420" | commitlint # passes

# header
echo "header" | commitlint # fails
echo "header." | commitlint # passes
echo "header #42" | commitlint # passes
echo "header #420" | commitlint # passes

How Has This Been Tested?

By adding new test cases.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Member

@byCedric byCedric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, I like this feature ❤️ @marionebl what do you think?

@sepehr sepehr changed the title feat(rules): add regex support for [subject|header]-full-stop rules. feat(rules): add regex support for [subject|header]-full-stop rules Oct 5, 2019
@byCedric byCedric mentioned this pull request Oct 20, 2019
7 tasks
@escapedcat
Copy link
Member

I think this completely got lost during busy times.
@sepehr if you are still motivated and willing to rebase and switch the files to typescript I think we could merge this.
It was already approved anyways...
Sorry for the long delay!

@sepehr
Copy link
Author

sepehr commented Jul 25, 2020

Thanks for the update @escapedcat. Will surely do.

Since I got your attention, do you think #819 might also worth rebase and Typescript port?

@escapedcat
Copy link
Member

Yeah, sounds good to me! @byCedric already commented positive on #819. Thanks for your effort!

@escapedcat
Copy link
Member

@sepehr closing this for now. Please reopen if you find time for a rebase.

@escapedcat escapedcat closed this Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants