@@ -3,7 +3,7 @@ import 'types/case.dart';
33import 'types/commit.dart' ;
44import 'types/rule.dart' ;
55
6- Map <String , Rule > get supportedRules => {
6+ Map <String , RuleFunction > get supportedRules => {
77 'type-case' : caseRule (CommitComponent .type),
88 'type-empty' : emptyRule (CommitComponent .type),
99 'type-enum' : enumRule (CommitComponent .type),
@@ -39,14 +39,14 @@ Map<String, Rule> get supportedRules => {
3939 };
4040
4141/// Build full stop rule for commit component.
42- Rule fullStopRule (CommitComponent component) {
43- return (Commit commit, RuleConfig config) {
44- if (config is ! ValueRuleConfig ) {
42+ RuleFunction fullStopRule (CommitComponent component) {
43+ return (Commit commit, Rule config) {
44+ if (config is ! ValueRule ) {
4545 throw Exception ('$config is not ValueRuleConfig<String>' );
4646 }
4747 final raw = commit.componentRaw (component);
4848 final result = raw != null && ensureFullStop (raw, config.value);
49- final negated = config.condition == RuleConfigCondition .never;
49+ final negated = config.condition == RuleCondition .never;
5050 return RuleOutcome (
5151 valid: negated ? ! result : result,
5252 message: [
@@ -59,11 +59,11 @@ Rule fullStopRule(CommitComponent component) {
5959}
6060
6161/// Build leanding blank rule for commit component.
62- Rule leadingBlankRule (CommitComponent component) {
63- return (Commit commit, RuleConfig config) {
62+ RuleFunction leadingBlankRule (CommitComponent component) {
63+ return (Commit commit, Rule config) {
6464 final raw = commit.componentRaw (component);
6565 final result = raw != null && ensureLeadingBlank (raw);
66- final negated = config.condition == RuleConfigCondition .never;
66+ final negated = config.condition == RuleCondition .never;
6767 return RuleOutcome (
6868 valid: negated ? ! result : result,
6969 message: [
@@ -76,11 +76,11 @@ Rule leadingBlankRule(CommitComponent component) {
7676}
7777
7878/// Build leanding blank rule for commit component.
79- Rule emptyRule (CommitComponent component) {
80- return (Commit commit, RuleConfig config) {
79+ RuleFunction emptyRule (CommitComponent component) {
80+ return (Commit commit, Rule config) {
8181 final raw = commit.componentRaw (component);
8282 final result = ensureEmpty (raw);
83- final negated = config.condition == RuleConfigCondition .never;
83+ final negated = config.condition == RuleCondition .never;
8484 return RuleOutcome (
8585 valid: negated ? ! result : result,
8686 message:
@@ -90,14 +90,14 @@ Rule emptyRule(CommitComponent component) {
9090}
9191
9292/// Build case rule for commit component.
93- Rule caseRule (CommitComponent component) {
94- return (Commit commit, RuleConfig config) {
95- if (config is ! CaseRuleConfig ) {
93+ RuleFunction caseRule (CommitComponent component) {
94+ return (Commit commit, Rule config) {
95+ if (config is ! CaseRule ) {
9696 throw Exception ('$config is not CaseRuleConfig' );
9797 }
9898 final raw = commit.componentRaw (component);
9999 final result = raw != null && ensureCase (raw, config.type);
100- final negated = config.condition == RuleConfigCondition .never;
100+ final negated = config.condition == RuleCondition .never;
101101 return RuleOutcome (
102102 valid: negated ? ! result : result,
103103 message: [
@@ -110,14 +110,14 @@ Rule caseRule(CommitComponent component) {
110110}
111111
112112/// Build max length rule for commit component.
113- Rule maxLengthRule (CommitComponent component) {
114- return (Commit commit, RuleConfig config) {
115- if (config is ! LengthRuleConfig ) {
113+ RuleFunction maxLengthRule (CommitComponent component) {
114+ return (Commit commit, Rule config) {
115+ if (config is ! LengthRule ) {
116116 throw Exception ('$config is not LengthRuleConfig' );
117117 }
118118 final raw = commit.componentRaw (component);
119119 final result = raw != null && ensureMaxLength (raw, config.length);
120- final negated = config.condition == RuleConfigCondition .never;
120+ final negated = config.condition == RuleCondition .never;
121121 return RuleOutcome (
122122 valid: negated ? ! result : result,
123123 message: [
@@ -130,14 +130,14 @@ Rule maxLengthRule(CommitComponent component) {
130130}
131131
132132/// Build max line length rule for commit component.
133- Rule maxLineLengthRule (CommitComponent component) {
134- return (Commit commit, RuleConfig config) {
135- if (config is ! LengthRuleConfig ) {
133+ RuleFunction maxLineLengthRule (CommitComponent component) {
134+ return (Commit commit, Rule config) {
135+ if (config is ! LengthRule ) {
136136 throw Exception ('$config is not LengthRuleConfig' );
137137 }
138138 final raw = commit.componentRaw (component);
139139 final result = raw != null && ensureMaxLineLength (raw, config.length);
140- final negated = config.condition == RuleConfigCondition .never;
140+ final negated = config.condition == RuleCondition .never;
141141 return RuleOutcome (
142142 valid: negated ? ! result : result,
143143 message: [
@@ -150,14 +150,14 @@ Rule maxLineLengthRule(CommitComponent component) {
150150}
151151
152152/// Build min length rule for commit component.
153- Rule minLengthRule (CommitComponent component) {
154- return (Commit commit, RuleConfig config) {
155- if (config is ! LengthRuleConfig ) {
153+ RuleFunction minLengthRule (CommitComponent component) {
154+ return (Commit commit, Rule config) {
155+ if (config is ! LengthRule ) {
156156 throw Exception ('$config is not LengthRuleConfig' );
157157 }
158158 final raw = commit.componentRaw (component);
159159 final result = raw != null && ensureMinLength (raw, config.length);
160- final negated = config.condition == RuleConfigCondition .never;
160+ final negated = config.condition == RuleCondition .never;
161161 return RuleOutcome (
162162 valid: negated ? ! result : result,
163163 message: [
@@ -169,14 +169,14 @@ Rule minLengthRule(CommitComponent component) {
169169 };
170170}
171171
172- Rule enumRule (CommitComponent component) {
173- return (Commit commit, RuleConfig config) {
174- if (config is ! EnumRuleConfig ) {
172+ RuleFunction enumRule (CommitComponent component) {
173+ return (Commit commit, Rule config) {
174+ if (config is ! EnumRule ) {
175175 throw Exception ('$config is not EnumRuleConfig' );
176176 }
177177 final raw = commit.componentRaw (component);
178178 final result = ensureEnum (raw, config.allowed);
179- final negated = config.condition == RuleConfigCondition .never;
179+ final negated = config.condition == RuleCondition .never;
180180 return RuleOutcome (
181181 valid: negated ? ! result : result,
182182 message: [
0 commit comments