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
I've been working on a custom plugin with custom rules, and for some of the rules I want to apply to all commit comments, however for other rules I want to only apply for non-WIP commits. I don't believe I can currently do this on a per rule basis.
Expected Behaviour
What I would like to do is something like this (ignore rule names since they refer to custom rules I created):
Notice how some rules use some new when values to only apply to non-WIP commits, while others apply to all commits.
As you can see, what I would like to do is specify in my configuration always-in-non-wips or never-in-non-wips since my custom plugin identifies whether a commit is a WIP or not and if it is a WIP and the when value is one of these custom values, it just returns [true] as it skips validating the WIP commit.
If the commit isn't a WIP though, then it converts the custom when to the standard equivalent: always-in-non-wips => always; never-in-non-wips => never. It then proceeds to validate accordingly.
In the configuration example above, many of the custom rules delegate to the standard corresponding rules such as subject-case, subject-full-stop, but the custom rules short-circuit for WIP commits if the when value stipulates to only validate non-WIPs. Otherwise it delegates to the standard rules after converting the when to the corresponding standard always and never values as necessary.
Current Behaviour
This all works great with one problem I didn't anticipate - the overall commitlint linter rejects any custom when value in a configuration and so blows everything up, so I can't do this.
Not allowing individual rules to allow for more than two different rule conditions seems quite limiting, and I'm raising this Issue to get some feedback on this.
Suggestion
My suggestion would be to update the linter to avoid globally policing the allowable when values and instead delegate that to individual rules to allow each one to police which values it accepts.
Affected packages
cli
core
prompt
config-angular
Your Environment
Executable
Version
commitlint --version
8.3.5
git --version
2.25.0
node --version
12.16.1
The text was updated successfully, but these errors were encountered:
danrivett
added a commit
to elevai-consulting/commitlint-github
that referenced
this issue
Feb 21, 2020
…ever-in-non-wips' to allow rules to be configured for just non-WIPs.
This new functionality currently cannot be used since commitlint prevents custom 'When' values in its top-level linter, but the work had already been done so checking this in in case in future this changes.
I created a GitHub Issue asking about that possibility: conventional-changelog/commitlint#1003.
danrivett
added a commit
to elevai-consulting/commitlint-github
that referenced
this issue
Feb 22, 2020
…ever-in-non-wips' to allow rules to be configured for just non-WIPs.
This new functionality currently cannot be used since commitlint prevents custom 'When' values in its top-level linter, but the work had already been done so checking this in in case in future this changes.
I created a GitHub Issue asking about that possibility: conventional-changelog/commitlint#1003.
As a follow-up I just published a new commitlint plugin - commitlint-plugin-github - which was the trigger for this feature request.
Currently I've had to revert code in the plugin and globally disable certain rules from being evaluated against WIP commits since I cannot configure certain rules to apply against WIP commits, but other rules not to.
I've been working on a custom plugin with custom rules, and for some of the rules I want to apply to all commit comments, however for other rules I want to only apply for non-WIP commits. I don't believe I can currently do this on a per rule basis.
Expected Behaviour
What I would like to do is something like this (ignore rule names since they refer to custom rules I created):
Notice how some rules use some new
when
values to only apply to non-WIP commits, while others apply to all commits.As you can see, what I would like to do is specify in my configuration
always-in-non-wips
ornever-in-non-wips
since my custom plugin identifies whether a commit is a WIP or not and if it is a WIP and thewhen
value is one of these custom values, it just returns[true]
as it skips validating the WIP commit.If the commit isn't a WIP though, then it converts the custom
when
to the standard equivalent:always-in-non-wips
=>always
;never-in-non-wips
=>never
. It then proceeds to validate accordingly.In the configuration example above, many of the custom rules delegate to the standard corresponding rules such as
subject-case
,subject-full-stop
, but the custom rules short-circuit for WIP commits if thewhen
value stipulates to only validate non-WIPs. Otherwise it delegates to the standard rules after converting thewhen
to the corresponding standardalways
andnever
values as necessary.Current Behaviour
This all works great with one problem I didn't anticipate - the overall commitlint linter rejects any custom
when
value in a configuration and so blows everything up, so I can't do this.Not allowing individual rules to allow for more than two different rule conditions seems quite limiting, and I'm raising this Issue to get some feedback on this.
Suggestion
My suggestion would be to update the linter to avoid globally policing the allowable
when
values and instead delegate that to individual rules to allow each one to police which values it accepts.Affected packages
Your Environment
commitlint --version
git --version
node --version
The text was updated successfully, but these errors were encountered: