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 would like to be able to set escalating limitations of values for particular rules. For example, setting a warning at header-max-length>=50 but an error at header-max-length>72.
We should be able to either
Have rule functions that are passed the commit message's attribute value so they can conditionally return the appropriate rule level, applicability, and value.
Allow specifying multiple rule levels at once (an array of rule conditions, only one rule condition(i.e. value+applicability) per level)
I set a function for each of the rules, and they don't seem to be passed any values at all. I can't seem to find an existing issue or anything on the roadmap that talks about this feature.
Thanks for your consideration!
Expected Behavior
{"header-max-length": [[2,"always",72],[1,"always",50]]}// currently throws Error: level for rule header-max-length must be number, received [ 2, 'always', 72 ] of type object// or{"header-max-length": (value)=>value>=50 ? [[2,"always",72] : [1,"always",50]]}// or{"header-max-length": async(value)=>value>=50 ? [[2,"always",72] : [1,"always",50]]}// or{"header-max-length": (value)=>Promise.resolve(value>=50 ? [[2,"always",72] : [1,"always",50]])}
Current Behavior
The current docs say that we can do the following:
Change the rules map/object Map<ruleName, ruleConditions> to Map<ruleName, Map<ruleLevel, ruleConditions> where ruleConditions removes the level index in the latter config.
I believe the actual work running all the rules (runtime commit msg adding to the built rules) is done here. I think we need to make loaded.rules a function instead of an object.
Steps to Reproduce (for bugs)
N/A
Context
Obviously this is a breaking change, so we should be cautious. I think the most important part is agreeing that this functionality is desired.
I liked that the rules config accepted functions for the conditions, but I was really surprised that the functions aren't passed any information at all. It seems like the execution of the rules is supposed to be a build-timeexecution and not a run-time execution, so it would be a non-trivial undertaking to add this functionality.
Am I understanding the code correctly?
Your Environment
Executable
Version
commitlint --version
8.1.0
git --version
2.22.0
node --version
v12.6.0
The text was updated successfully, but these errors were encountered:
I would like to be able to set escalating limitations of values for particular rules. For example, setting a warning at
header-max-length>=50
but an error atheader-max-length>72
.We should be able to either
I set a function for each of the rules, and they don't seem to be passed any values at all. I can't seem to find an existing issue or anything on the roadmap that talks about this feature.
Thanks for your consideration!
Expected Behavior
Current Behavior
The current docs say that we can do the following:
Affected packages
Possible Solution
Change the rules map/object
Map<ruleName, ruleConditions>
toMap<ruleName, Map<ruleLevel, ruleConditions>
where ruleConditions removes thelevel
index in the latter config.I believe the actual work running all the rules (runtime commit msg adding to the built rules) is done here. I think we need to make
loaded.rules
a function instead of an object.Steps to Reproduce (for bugs)
N/A
Context
Obviously this is a breaking change, so we should be cautious. I think the most important part is agreeing that this functionality is desired.
I liked that the rules config accepted functions for the conditions, but I was really surprised that the functions aren't passed any information at all. It seems like the execution of the rules is supposed to be a build-time execution and not a run-time execution, so it would be a non-trivial undertaking to add this functionality.
Am I understanding the code correctly?
Your Environment
commitlint --version
git --version
node --version
The text was updated successfully, but these errors were encountered: