File tree 4 files changed +58
-3
lines changed
4 files changed +58
-3
lines changed Original file line number Diff line number Diff line change @@ -45,9 +45,14 @@ class CommitLintRunner extends CommandRunner {
45
45
final messages =
46
46
fromStdin ? await _stdin () : await read (from: from, to: to, edit: edit);
47
47
final config = await load (topLevelResults['config' ]);
48
- final results = (await Future .wait (messages.map ((message) async =>
49
- await lint (message, config.rules,
50
- defaultIgnores: config.defaultIgnores, ignores: config.ignores))));
48
+ final results =
49
+ (await Future .wait (messages.map ((message) async => await lint (
50
+ message,
51
+ config.rules,
52
+ parserOptions: config.parser,
53
+ defaultIgnores: config.defaultIgnores,
54
+ ignores: config.ignores,
55
+ ))));
51
56
if (config.rules.isEmpty) {
52
57
String input = '' ;
53
58
if (results.isNotEmpty) {
Original file line number Diff line number Diff line change
1
+ # https://github.com/hyiso/commitlint/blob/main/lib/commitlint.yaml
2
+ include : package:commitlint_cli/commitlint.yaml
3
+
4
+ # https://github.com/hyiso/commitlint/pull/22
5
+ parser :
6
+ issuePrefixes :
7
+ - " sv-"
8
+
9
+ # https://hyiso.github.io/commitlint/#/references-rules
10
+ rules :
11
+ type-enum :
12
+ - 2
13
+ - always
14
+ - - build
15
+ - chore
16
+ - docs
17
+ - feat
18
+ - fix
19
+ - refactor
20
+ - revert
21
+ - style
22
+ - test
23
+ scope-enum :
24
+ - 2
25
+ - always
26
+ - - domain
27
+ - infrastructures
28
+ - use_cases
29
+ - interfaces
30
+ - lib
31
+ - root
32
+ references-empty :
33
+ - 2
34
+ - never
Original file line number Diff line number Diff line change 1
1
import 'package:commitlint_cli/src/lint.dart' ;
2
+ import 'package:commitlint_cli/src/load.dart' ;
2
3
import 'package:commitlint_cli/src/types/rule.dart' ;
3
4
import 'package:test/test.dart' ;
4
5
@@ -138,4 +139,14 @@ Signed-off-by: dependabot[bot] <support@github.com>
138
139
expect (result.valid, true );
139
140
expect (result.input, equals (message));
140
141
});
142
+
143
+ test ('should use custom parser options with custom issuePrefixes' , () async {
144
+ final config = await load ('test/__fixtures__/parser-options.yaml' );
145
+ final result = await lint (
146
+ 'fix(root): fix commitlint config sv-1' ,
147
+ config.rules,
148
+ parserOptions: config.parser,
149
+ );
150
+ expect (result.valid, true );
151
+ });
141
152
}
Original file line number Diff line number Diff line change @@ -40,4 +40,9 @@ void main() {
40
40
expect (config.defaultIgnores, equals (null ));
41
41
expect (config.ignores, equals (["r'^fixup'" ]));
42
42
});
43
+ test ('custom parser options should work' , () async {
44
+ final config = await load ('test/__fixtures__/parser-options.yaml' );
45
+ expect (config.parser, isNotNull);
46
+ expect (config.parser! .issuePrefixes, equals (['sv-' ]));
47
+ });
43
48
}
You can’t perform that action at this time.
0 commit comments