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

Lotram/customizable allowed prefixes #678

Merged

Conversation

Lotram
Copy link
Contributor

@Lotram Lotram commented Mar 2, 2023

Description

Related to #672
The allowed message prefix list can now be configured.
In particular, it can be set to an empty list, if we do not want to allow commits such as fixups.

I also fixed a typo in .pre-commit-config.yaml and a typing error in commitizen/cli.py

Checklist

  • Add test cases to all the changes you introduce
  • Run ./scripts/format and ./scripts/test locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

The allowed prefix list can be configured, either using a config file, or when using the cli directly.

Steps to Test This Pull Request

  1. poetry shell
  2. Run python commitizen/cli.py check --message 'fixup!' --allowed-prefixes 'Merge' 'Revert' 'Custom Prefix'. It should return an error
  3. Run python commitizen/cli.py check --message "Custom Prefix random text" --allowed-prefixes 'Merge' 'Revert' 'Custom Prefix'. It should pass

Additional context

@Lotram Lotram force-pushed the Lotram/customizable-allowed-prefixes branch 2 times, most recently from afed161 to a7ae3d7 Compare March 2, 2023 15:55
@woile
Copy link
Member

woile commented Apr 28, 2023

Sorry for the long delat, this feature looks dope! Can you rebase please 🙏🏻 ?

@Lotram Lotram closed this May 2, 2023
@Lotram Lotram force-pushed the Lotram/customizable-allowed-prefixes branch from a7ae3d7 to 672ff94 Compare May 2, 2023 12:19
@Lotram Lotram reopened this May 2, 2023
@codecov
Copy link

codecov bot commented May 2, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01 🎉

Comparison is base (eb39f8b) 97.31% compared to head (c77dcc5) 97.32%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #678      +/-   ##
==========================================
+ Coverage   97.31%   97.32%   +0.01%     
==========================================
  Files          42       42              
  Lines        2045     2055      +10     
==========================================
+ Hits         1990     2000      +10     
  Misses         55       55              
Flag Coverage Δ
unittests 97.32% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...en/cz/conventional_commits/conventional_commits.py 100.00% <ø> (ø)
commitizen/__version__.py 100.00% <100.00%> (ø)
commitizen/bump.py 100.00% <100.00%> (ø)
commitizen/changelog.py 100.00% <100.00%> (ø)
commitizen/changelog_parser.py 96.96% <100.00%> (+0.04%) ⬆️
commitizen/cli.py 94.20% <100.00%> (ø)
commitizen/commands/bump.py 98.14% <100.00%> (ø)
commitizen/commands/changelog.py 98.95% <100.00%> (+0.01%) ⬆️
commitizen/commands/check.py 100.00% <100.00%> (ø)
commitizen/commands/init.py 87.50% <100.00%> (+0.06%) ⬆️
... and 13 more

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Lotram
Copy link
Contributor Author

Lotram commented May 2, 2023

@woile Rebased. I removed the commit fixing the pre-commit config, as it has been fixed already

The allowed prefixes, which bypass the regex check,
can now be configured.
@Lotram Lotram force-pushed the Lotram/customizable-allowed-prefixes branch from e54741d to c77dcc5 Compare June 8, 2023 08:27
@Lotram
Copy link
Contributor Author

Lotram commented Jun 8, 2023

@woile rebased and all checks have passed

Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

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

Hi @Lotram , thanks for your contribution! Sorry for the late review. This looks great!

@woile I'm planning on merging it soon as well. Let me know if you have other thoughts. Thanks!

@Lee-W Lee-W added type: feature A new enhacement proposal pr-status: ready-to-merge almost ready to merge. just keep it for a few days for others to check labels Jun 23, 2023
@Lee-W
Copy link
Member

Lee-W commented Jun 23, 2023

close #672

@Lee-W Lee-W merged commit 3b9b4fd into commitizen-tools:master Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: ready-to-merge almost ready to merge. just keep it for a few days for others to check type: feature A new enhacement proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants