File tree Expand file tree Collapse file tree 4 files changed +58
-3
lines changed Expand file tree Collapse file tree 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 {
4545 final messages =
4646 fromStdin ? await _stdin () : await read (from: from, to: to, edit: edit);
4747 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+ ))));
5156 if (config.rules.isEmpty) {
5257 String input = '' ;
5358 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 11import 'package:commitlint_cli/src/lint.dart' ;
2+ import 'package:commitlint_cli/src/load.dart' ;
23import 'package:commitlint_cli/src/types/rule.dart' ;
34import 'package:test/test.dart' ;
45
138139 expect (result.valid, true );
139140 expect (result.input, equals (message));
140141 });
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+ });
141152}
Original file line number Diff line number Diff line change @@ -40,4 +40,9 @@ void main() {
4040 expect (config.defaultIgnores, equals (null ));
4141 expect (config.ignores, equals (["r'^fixup'" ]));
4242 });
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+ });
4348}
You can’t perform that action at this time.
0 commit comments