From 76dd5954cf71eac6c40d75bac735c0300af5992b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 09:15:07 +0000 Subject: [PATCH 01/21] chore(deps): Bump lint_staged from 0.3.0 to 0.4.0 Bumps [lint_staged](https://github.com/hyiso/lint_staged) from 0.3.0 to 0.4.0. - [Release notes](https://github.com/hyiso/lint_staged/releases) - [Changelog](https://github.com/hyiso/lint_staged/blob/main/CHANGELOG.md) - [Commits](https://github.com/hyiso/lint_staged/compare/v0.3.0...v0.4.0) --- updated-dependencies: - dependency-name: lint_staged dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 979f661..eee7e7a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: dev_dependencies: collection: ^1.17.1 husky: ^0.1.6 - lint_staged: ">=0.2.0 <0.4.0" + lint_staged: ">=0.2.0 <0.5.0" lints: ^2.0.0 test: ^1.21.0 uuid: ^3.0.7 From 102391716e9988b15d7270fa5405e9a979e5be72 Mon Sep 17 00:00:00 2001 From: hyiso Date: Wed, 9 Aug 2023 00:32:44 +0800 Subject: [PATCH 02/21] chore: fix pr_title action --- .github/workflows/pr_title.yml | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml index 2d0736d..2a89a5a 100644 --- a/.github/workflows/pr_title.yml +++ b/.github/workflows/pr_title.yml @@ -14,4 +14,4 @@ jobs: run: dart pub get - name: Validate Title of PR - run: echo ${{ github.event.pull_request.title }} | dart bin/commitlint_cli.dart --config lib/commitlint.yaml \ No newline at end of file + run: echo '${{ github.event.pull_request.title }}' | dart bin/commitlint_cli.dart --config lib/commitlint.yaml \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index eee7e7a..9a74856 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: dev_dependencies: collection: ^1.17.1 husky: ^0.1.6 - lint_staged: ">=0.2.0 <0.5.0" + lint_staged: ^0.4.0 lints: ^2.0.0 test: ^1.21.0 uuid: ^3.0.7 From aa6080696086d4849d7897939bc351a80a825887 Mon Sep 17 00:00:00 2001 From: hyiso Date: Sun, 20 Aug 2023 22:17:13 +0800 Subject: [PATCH 03/21] chore(deps): Bump `ansi` version to `0.3.0`, `change_case` to `1.1.0` --- lib/src/format.dart | 14 +++++++------- pubspec.yaml | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/src/format.dart b/lib/src/format.dart index e859e06..0024449 100644 --- a/lib/src/format.dart +++ b/lib/src/format.dart @@ -4,7 +4,7 @@ import 'types/format.dart'; import 'types/lint.dart'; const _kDefaultSigns = [' ', '⚠', '✖']; -final _defaultColors = [ansi.white, ansi.yellow, ansi.red]; +final _defaultColors = [white, yellow, red]; /// /// Format commitlint [report] to formatted output message. @@ -22,10 +22,10 @@ String format({ List _formatInput(LintOutcome result) { final sign = '⧗'; - final decoration = ansi.gray(sign); + final decoration = gray(sign); final commitText = result.errors.isNotEmpty ? result.input : result.input.split('\n').first; - final decoratedInput = ansi.bold(commitText); + final decoratedInput = bold(commitText); final hasProblem = result.errors.isNotEmpty || result.warnings.isNotEmpty; return hasProblem || Verbose.enabled ? ['$decoration input: $decoratedInput'] @@ -37,7 +37,7 @@ List _formatResult(LintOutcome result) { final sign = _kDefaultSigns[problem.level.index]; final color = _defaultColors[problem.level.index]; final decoration = color(sign); - final name = ansi.gray(problem.name); + final name = gray(problem.name); return '$decoration ${problem.message} $name'; }); @@ -47,7 +47,7 @@ List _formatResult(LintOutcome result) { final summary = problems.isNotEmpty || Verbose.enabled ? '$decoration found ${result.errors.length} error(s), ${result.warnings.length} warning(s)' : ''; - final fmtSummary = summary.isNotEmpty ? ansi.bold(summary) : summary; + final fmtSummary = summary.isNotEmpty ? bold(summary) : summary; return [ ...problems, if (problems.isNotEmpty) '', @@ -65,7 +65,7 @@ String _selectSign(LintOutcome result) { String Function(String) _selectColor(LintOutcome result) { if (result.errors.isNotEmpty) { - return ansi.red; + return red; } - return result.warnings.isNotEmpty ? ansi.yellow : ansi.green; + return result.warnings.isNotEmpty ? yellow : green; } diff --git a/pubspec.yaml b/pubspec.yaml index 9a74856..fdf4bff 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,9 +8,9 @@ environment: sdk: '>=2.15.0 <3.0.0' dependencies: - ansi: ^0.2.2 + ansi: ^0.3.0 args: ^2.3.1 - change_case: ^1.0.0+3 + change_case: ^1.1.0 path: ^1.8.0 verbose: ^0.1.0 yaml: ^3.1.1 From 6e4d3d811d22b73b5974c530ff1c6f2dd47e9fce Mon Sep 17 00:00:00 2001 From: hyiso Date: Sun, 20 Aug 2023 22:20:45 +0800 Subject: [PATCH 04/21] chore(release): release v0.6.2 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98ea30c..53b8a29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.6.2 + + - Bump `ansi` version to `0.3.0`, `change_case` to `1.1.0` + ## 0.6.1 - Fix bug in reading history commits when body contains multi lines diff --git a/pubspec.yaml b/pubspec.yaml index fdf4bff..a9048e7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: commitlint_cli description: Commitlint lint commit messages to satisfy conventional commit format -version: 0.6.1 +version: 0.6.2 homepage: https://github.com/hyiso/commitlint documentation: https://hyiso.github.io/commitlint From 2a1b84bc50527e49f5e8c8750100f36a11d1fbbb Mon Sep 17 00:00:00 2001 From: hyiso Date: Fri, 1 Sep 2023 23:34:05 +0800 Subject: [PATCH 05/21] chore(deps): Bump `ansi` to `0.4.0` --- pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index a9048e7..2be5fd5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: '>=2.15.0 <3.0.0' dependencies: - ansi: ^0.3.0 + ansi: ^0.4.0 args: ^2.3.1 change_case: ^1.1.0 path: ^1.8.0 @@ -18,7 +18,7 @@ dependencies: dev_dependencies: collection: ^1.17.1 husky: ^0.1.6 - lint_staged: ^0.4.0 + lint_staged: ^0.4.2 lints: ^2.0.0 test: ^1.21.0 uuid: ^3.0.7 From 33ca1d92e57f3267497681934de576ba8b3b76ca Mon Sep 17 00:00:00 2001 From: hyiso Date: Fri, 1 Sep 2023 23:35:33 +0800 Subject: [PATCH 06/21] chore(release): release v0.6.3 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53b8a29..9c49a56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.6.3 + + - Bump `ansi` version `0.4.0` + ## 0.6.2 - Bump `ansi` version to `0.3.0`, `change_case` to `1.1.0` diff --git a/pubspec.yaml b/pubspec.yaml index 2be5fd5..9c49078 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: commitlint_cli description: Commitlint lint commit messages to satisfy conventional commit format -version: 0.6.2 +version: 0.6.3 homepage: https://github.com/hyiso/commitlint documentation: https://hyiso.github.io/commitlint From ca161c958469011afa4571a7829aaa9bb23884e9 Mon Sep 17 00:00:00 2001 From: hyiso Date: Tue, 5 Sep 2023 23:16:05 +0800 Subject: [PATCH 07/21] chore(deps): remove `uuid` --- pubspec.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9c49078..6fb1774 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,7 +21,6 @@ dev_dependencies: lint_staged: ^0.4.2 lints: ^2.0.0 test: ^1.21.0 - uuid: ^3.0.7 lint_staged: '**.dart': dart fix --apply && dart format --fix \ No newline at end of file From 7b4ce74f44416ed3067ef0dbd21216388cb9a673 Mon Sep 17 00:00:00 2001 From: hyiso Date: Sat, 9 Sep 2023 23:21:12 +0800 Subject: [PATCH 08/21] feat: support `references-empty` rule.(fix #17) --- lib/src/ensure.dart | 2 +- lib/src/rules.dart | 1 + lib/src/types/commit.dart | 3 +++ test/lint_test.dart | 20 ++++++++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/src/ensure.dart b/lib/src/ensure.dart index 86f510d..83b7fa0 100644 --- a/lib/src/ensure.dart +++ b/lib/src/ensure.dart @@ -74,7 +74,7 @@ bool ensureEmpty(dynamic raw) { if (raw is String) { return raw.isEmpty; } - if (raw is Iterable) { + if (raw is Iterable) { return raw.isEmpty; } return false; diff --git a/lib/src/rules.dart b/lib/src/rules.dart index 8134d02..116b884 100644 --- a/lib/src/rules.dart +++ b/lib/src/rules.dart @@ -36,6 +36,7 @@ Map get supportedRules => { 'footer-max-length': maxLengthRule(CommitComponent.footer), 'footer-max-line-length': maxLineLengthRule(CommitComponent.footer), 'footer-min-length': minLengthRule(CommitComponent.footer), + 'references-empty': emptyRule(CommitComponent.references), }; /// Build full stop rule for commit component. diff --git a/lib/src/types/commit.dart b/lib/src/types/commit.dart index 56c9b45..504ec3a 100644 --- a/lib/src/types/commit.dart +++ b/lib/src/types/commit.dart @@ -53,6 +53,8 @@ class Commit { return body as T?; case CommitComponent.footer: return footer as T?; + case CommitComponent.references: + return references as T?; } } } @@ -64,6 +66,7 @@ enum CommitComponent { header, body, footer, + references, } /// Commit Note diff --git a/test/lint_test.dart b/test/lint_test.dart index 620ea13..c8b6237 100644 --- a/test/lint_test.dart +++ b/test/lint_test.dart @@ -92,6 +92,26 @@ void main() { throwsRangeError); }); + test('succeds for issue', () async { + final result = await lint('somehting #1', { + 'references-empty': Rule( + severity: RuleSeverity.error, + condition: RuleCondition.never, + ), + }); + expect(result.valid, true); + }); + + test('fails for issue', () async { + final result = await lint('somehting #1', { + 'references-empty': Rule( + severity: RuleSeverity.error, + condition: RuleCondition.always, + ), + }); + expect(result.valid, false); + }); + test('positive on multi-line body message', () async { final message = '''chore(deps): bump commitlint_cli from 0.5.0 to 0.6.0 Bumps [commitlint_cli](https://github.com/hyiso/commitlint) from 0.5.0 to 0.6.0. From bc0165662b16980f0e6859cf86bed253e4d50e3a Mon Sep 17 00:00:00 2001 From: hyiso Date: Sat, 9 Sep 2023 23:24:17 +0800 Subject: [PATCH 09/21] chore(release): release v0.7.0 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c49a56..4f1eea6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.7.0 + + - Support `references-empty` rule. + ## 0.6.3 - Bump `ansi` version `0.4.0` diff --git a/pubspec.yaml b/pubspec.yaml index 6fb1774..d69b20c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: commitlint_cli description: Commitlint lint commit messages to satisfy conventional commit format -version: 0.6.3 +version: 0.7.0 homepage: https://github.com/hyiso/commitlint documentation: https://hyiso.github.io/commitlint From 99c88a799c5f771392477320528202f65fbc1965 Mon Sep 17 00:00:00 2001 From: hyiso Date: Fri, 15 Sep 2023 12:32:28 +0800 Subject: [PATCH 10/21] docs: add `references-empty` rule --- docs/references-rules.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/references-rules.md b/docs/references-rules.md index ae7a1b2..2c271fa 100644 --- a/docs/references-rules.md +++ b/docs/references-rules.md @@ -350,4 +350,9 @@ Infinity ``` 0 -``` \ No newline at end of file +``` + +#### references-empty + +- **condition**: `references` has at least one entry +- **rule**: `never` \ No newline at end of file From c07687e20fbed537eaa9c47b94637eb91406897e Mon Sep 17 00:00:00 2001 From: hyiso Date: Fri, 6 Oct 2023 00:07:01 +0800 Subject: [PATCH 11/21] fix: rule should pass if commit component raw is null (fix #18) --- lib/src/ensure.dart | 56 +++++++++++++++++++-------------------------- lib/src/rules.dart | 29 +++++++++++------------ 2 files changed, 38 insertions(+), 47 deletions(-) diff --git a/lib/src/ensure.dart b/lib/src/ensure.dart index 83b7fa0..b589a38 100644 --- a/lib/src/ensure.dart +++ b/lib/src/ensure.dart @@ -6,27 +6,27 @@ bool ensureCase(dynamic raw, Case target) { if (raw is Iterable) { return raw.isEmpty || raw.every((element) => ensureCase(element, target)); } - if (raw is! String) { - return false; - } - switch (target) { - case Case.lower: - return raw.toLowerCase() == raw; - case Case.upper: - return raw.toUpperCase() == raw; - case Case.camel: - return raw.toCamelCase() == raw; - case Case.kebab: - return raw.toKebabCase() == raw; - case Case.pascal: - return raw.toPascalCase() == raw; - case Case.sentence: - return raw.toSentenceCase() == raw; - case Case.snake: - return raw.toSnakeCase() == raw; - case Case.capital: - return raw.toCapitalCase() == raw; + if (raw is String) { + switch (target) { + case Case.lower: + return raw.toLowerCase() == raw; + case Case.upper: + return raw.toUpperCase() == raw; + case Case.camel: + return raw.toCamelCase() == raw; + case Case.kebab: + return raw.toKebabCase() == raw; + case Case.pascal: + return raw.toPascalCase() == raw; + case Case.sentence: + return raw.toSentenceCase() == raw; + case Case.snake: + return raw.toSnakeCase() == raw; + case Case.capital: + return raw.toCapitalCase() == raw; + } } + return false; } bool ensureFullStop(String raw, String target) { @@ -38,9 +38,6 @@ bool ensureLeadingBlank(String raw) { } bool ensureMaxLength(dynamic raw, num maxLength) { - if (raw == null) { - return true; - } if (raw is String) { return raw.length <= maxLength; } @@ -51,13 +48,12 @@ bool ensureMaxLength(dynamic raw, num maxLength) { } bool ensureMaxLineLength(String raw, num maxLineLength) { - return raw.split('\n').every((line) => ensureMaxLength(line, maxLineLength)); + return raw + .split(RegExp(r'(?:\r?\n)')) + .every((line) => ensureMaxLength(line, maxLineLength)); } bool ensureMinLength(dynamic raw, num minLength) { - if (raw == null) { - return false; - } if (raw is String) { return raw.length >= minLength; } @@ -68,9 +64,6 @@ bool ensureMinLength(dynamic raw, num minLength) { } bool ensureEmpty(dynamic raw) { - if (raw == null) { - return true; - } if (raw is String) { return raw.isEmpty; } @@ -81,9 +74,6 @@ bool ensureEmpty(dynamic raw) { } bool ensureEnum(dynamic raw, Iterable enums) { - if (raw == null) { - return true; - } if (raw is String) { return raw.isEmpty || enums.contains(raw); } diff --git a/lib/src/rules.dart b/lib/src/rules.dart index 116b884..bc5f684 100644 --- a/lib/src/rules.dart +++ b/lib/src/rules.dart @@ -39,14 +39,14 @@ Map get supportedRules => { 'references-empty': emptyRule(CommitComponent.references), }; -/// Build full stop rule for commit component. +/// Build full-stop rule for commit component. RuleFunction fullStopRule(CommitComponent component) { return (Commit commit, Rule config) { if (config is! ValueRule) { throw Exception('$config is not ValueRuleConfig'); } final raw = commit.componentRaw(component); - final result = raw != null && ensureFullStop(raw, config.value); + final result = raw == null || ensureFullStop(raw, config.value); final negated = config.condition == RuleCondition.never; return RuleOutcome( valid: negated ? !result : result, @@ -59,11 +59,11 @@ RuleFunction fullStopRule(CommitComponent component) { }; } -/// Build leanding blank rule for commit component. +/// Build leanding-blank rule for commit component. RuleFunction leadingBlankRule(CommitComponent component) { return (Commit commit, Rule config) { final raw = commit.componentRaw(component); - final result = raw != null && ensureLeadingBlank(raw); + final result = raw == null || ensureLeadingBlank(raw); final negated = config.condition == RuleCondition.never; return RuleOutcome( valid: negated ? !result : result, @@ -76,11 +76,11 @@ RuleFunction leadingBlankRule(CommitComponent component) { }; } -/// Build leanding blank rule for commit component. +/// Build empty rule for commit component. RuleFunction emptyRule(CommitComponent component) { return (Commit commit, Rule config) { final raw = commit.componentRaw(component); - final result = ensureEmpty(raw); + final result = raw == null || ensureEmpty(raw); final negated = config.condition == RuleCondition.never; return RuleOutcome( valid: negated ? !result : result, @@ -97,7 +97,7 @@ RuleFunction caseRule(CommitComponent component) { throw Exception('$config is not CaseRuleConfig'); } final raw = commit.componentRaw(component); - final result = raw != null && ensureCase(raw, config.type); + final result = raw == null || ensureCase(raw, config.type); final negated = config.condition == RuleCondition.never; return RuleOutcome( valid: negated ? !result : result, @@ -110,14 +110,14 @@ RuleFunction caseRule(CommitComponent component) { }; } -/// Build max length rule for commit component. +/// Build max-length rule for commit component. RuleFunction maxLengthRule(CommitComponent component) { return (Commit commit, Rule config) { if (config is! LengthRule) { throw Exception('$config is not LengthRuleConfig'); } final raw = commit.componentRaw(component); - final result = raw != null && ensureMaxLength(raw, config.length); + final result = raw == null || ensureMaxLength(raw, config.length); final negated = config.condition == RuleCondition.never; return RuleOutcome( valid: negated ? !result : result, @@ -130,14 +130,14 @@ RuleFunction maxLengthRule(CommitComponent component) { }; } -/// Build max line length rule for commit component. +/// Build max-line-length rule for commit component. RuleFunction maxLineLengthRule(CommitComponent component) { return (Commit commit, Rule config) { if (config is! LengthRule) { throw Exception('$config is not LengthRuleConfig'); } final raw = commit.componentRaw(component); - final result = raw != null && ensureMaxLineLength(raw, config.length); + final result = raw == null || ensureMaxLineLength(raw, config.length); final negated = config.condition == RuleCondition.never; return RuleOutcome( valid: negated ? !result : result, @@ -150,14 +150,14 @@ RuleFunction maxLineLengthRule(CommitComponent component) { }; } -/// Build min length rule for commit component. +/// Build min-length rule for commit component. RuleFunction minLengthRule(CommitComponent component) { return (Commit commit, Rule config) { if (config is! LengthRule) { throw Exception('$config is not LengthRuleConfig'); } final raw = commit.componentRaw(component); - final result = raw != null && ensureMinLength(raw, config.length); + final result = raw == null || ensureMinLength(raw, config.length); final negated = config.condition == RuleCondition.never; return RuleOutcome( valid: negated ? !result : result, @@ -170,13 +170,14 @@ RuleFunction minLengthRule(CommitComponent component) { }; } +/// Build enum rule for commit component. RuleFunction enumRule(CommitComponent component) { return (Commit commit, Rule config) { if (config is! EnumRule) { throw Exception('$config is not EnumRuleConfig'); } final raw = commit.componentRaw(component); - final result = ensureEnum(raw, config.allowed); + final result = raw == null || ensureEnum(raw, config.allowed); final negated = config.condition == RuleCondition.never; return RuleOutcome( valid: negated ? !result : result, From 91b2ec166fa6012d0f614b7bfaf1c240f4a007ac Mon Sep 17 00:00:00 2001 From: hyiso Date: Fri, 6 Oct 2023 16:00:34 +0800 Subject: [PATCH 12/21] chore(release): release v0.7.1 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f1eea6..3ee5dce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.7.1 + + - rule should pass if commit component raw is null (fix #18) + ## 0.7.0 - Support `references-empty` rule. diff --git a/pubspec.yaml b/pubspec.yaml index d69b20c..4f1dbb1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: commitlint_cli description: Commitlint lint commit messages to satisfy conventional commit format -version: 0.7.0 +version: 0.7.1 homepage: https://github.com/hyiso/commitlint documentation: https://hyiso.github.io/commitlint From c2a5d4a77369707299f8c01c5558b27497f04e73 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 09:13:56 +0000 Subject: [PATCH 13/21] chore(deps): Bump lint_staged from 0.4.3 to 0.5.0 Bumps [lint_staged](https://github.com/hyiso/lint_staged) from 0.4.3 to 0.5.0. - [Release notes](https://github.com/hyiso/lint_staged/releases) - [Changelog](https://github.com/hyiso/lint_staged/blob/main/CHANGELOG.md) - [Commits](https://github.com/hyiso/lint_staged/compare/v0.4.3...v0.5.0) --- updated-dependencies: - dependency-name: lint_staged dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 4f1dbb1..2b55a91 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: dev_dependencies: collection: ^1.17.1 husky: ^0.1.6 - lint_staged: ^0.4.2 + lint_staged: ">=0.4.2 <0.6.0" lints: ^2.0.0 test: ^1.21.0 From 03f5966c65f40f6043d3c2f7b06629c8e3cc7570 Mon Sep 17 00:00:00 2001 From: hyiso Date: Mon, 22 Jan 2024 17:25:26 +0800 Subject: [PATCH 14/21] chore(deps): Bump lint_staged's minmum verison to 0.5.0 --- pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 2b55a91..99b04af 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,9 +18,9 @@ dependencies: dev_dependencies: collection: ^1.17.1 husky: ^0.1.6 - lint_staged: ">=0.4.2 <0.6.0" + lint_staged: ^0.5.0 lints: ^2.0.0 test: ^1.21.0 lint_staged: - '**.dart': dart fix --apply && dart format --fix \ No newline at end of file + '**.dart': dart fix --apply && dart format --fix From 72a8bff0fb57d3fba1787e1f5afbcba1ae98d13a Mon Sep 17 00:00:00 2001 From: hyiso Date: Mon, 21 Oct 2024 18:57:04 +0800 Subject: [PATCH 15/21] fix: ignoring multiline merge commit message (#20) --- lib/src/is_ignored.dart | 28 +++++++++++----------------- test/ignore_test.dart | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 test/ignore_test.dart diff --git a/lib/src/is_ignored.dart b/lib/src/is_ignored.dart index 71c64f6..c11d08a 100644 --- a/lib/src/is_ignored.dart +++ b/lib/src/is_ignored.dart @@ -1,22 +1,16 @@ bool isIgnored(String message, {bool? defaultIgnores, Iterable? ignores}) { - final base = defaultIgnores == false ? [] : wildcards; - return [...base, ...?ignores?.map(ignore)].any((mathcer) => mathcer(message)); + return [if (defaultIgnores != false) ..._wildcards, ...?ignores] + .any((pattern) => RegExp(pattern).hasMatch(message)); } -final wildcards = [ - ignore( - r'((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)'), - ignore(r'(Merge tag (.*?))(?:\r?\n)*$'), - ignore(r'(R|r)evert (.*)'), - ignore(r'(fixup|squash)!'), - ignore(r'(Merged (.*?)(in|into) (.*)|Merged PR (.*): (.*))'), - ignore(r'Merge remote-tracking branch(\s*)(.*)'), - ignore(r'Automatic merge(.*)'), - ignore(r'Auto-merged (.*?) into (.*)'), +final _wildcards = [ + r'((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*)', + r'(Merge tag (.*?))(?:\r?\n)*$', + r'(R|r)evert (.*)', + r'(fixup|squash)!', + r'(Merged (.*?)(in|into) (.*)|Merged PR (.*): (.*))', + r'Merge remote-tracking branch(\s*)(.*)', + r'Automatic merge(.*)', + r'Auto-merged (.*?) into (.*)', ]; - -Matcher ignore(String pattern) => - (String message) => RegExp(pattern).hasMatch(message); - -typedef Matcher = bool Function(String); diff --git a/test/ignore_test.dart b/test/ignore_test.dart new file mode 100644 index 0000000..7d65d2d --- /dev/null +++ b/test/ignore_test.dart @@ -0,0 +1,24 @@ +import 'package:commitlint_cli/src/lint.dart'; +import 'package:commitlint_cli/src/types/rule.dart'; +import 'package:test/test.dart'; + +void main() { + test('Should ignore configurated multi-line merge message', () async { + final message = '''Merge branch 'develop' into feature/xyz + +# Conflicts: +# xyz.yaml +'''; + final result = await lint( + message, + { + 'type-empty': Rule( + severity: RuleSeverity.error, + condition: RuleCondition.never, + ), + }, + defaultIgnores: true); + expect(result.valid, true); + expect(result.input, equals(message)); + }); +} From 7917343208963e7f9a829a4596732cb916241367 Mon Sep 17 00:00:00 2001 From: hyiso Date: Mon, 21 Oct 2024 19:00:06 +0800 Subject: [PATCH 16/21] chore: Release 0.7.2 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ee5dce..7df40ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.7.2 + + - ignoring mulitline merge commit message (fix #20) + ## 0.7.1 - rule should pass if commit component raw is null (fix #18) diff --git a/pubspec.yaml b/pubspec.yaml index 99b04af..9165ed4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: commitlint_cli description: Commitlint lint commit messages to satisfy conventional commit format -version: 0.7.1 +version: 0.7.2 homepage: https://github.com/hyiso/commitlint documentation: https://hyiso.github.io/commitlint From 69d78e6e901b3ddaea4c6fda0dcd6fcf9e13b533 Mon Sep 17 00:00:00 2001 From: hyiso Date: Mon, 21 Oct 2024 19:06:00 +0800 Subject: [PATCH 17/21] test: focus ignore_test --- test/ignore_test.dart | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/test/ignore_test.dart b/test/ignore_test.dart index 7d65d2d..ecd5d29 100644 --- a/test/ignore_test.dart +++ b/test/ignore_test.dart @@ -1,5 +1,4 @@ -import 'package:commitlint_cli/src/lint.dart'; -import 'package:commitlint_cli/src/types/rule.dart'; +import 'package:commitlint_cli/src/is_ignored.dart'; import 'package:test/test.dart'; void main() { @@ -9,16 +8,7 @@ void main() { # Conflicts: # xyz.yaml '''; - final result = await lint( - message, - { - 'type-empty': Rule( - severity: RuleSeverity.error, - condition: RuleCondition.never, - ), - }, - defaultIgnores: true); - expect(result.valid, true); - expect(result.input, equals(message)); + final result = isIgnored(message, defaultIgnores: true); + expect(result, true); }); } From 90abe8d27095eb9008114620825ecdd4d07f7805 Mon Sep 17 00:00:00 2001 From: hyiso Date: Mon, 11 Nov 2024 14:50:39 +0800 Subject: [PATCH 18/21] feat!: support parser options --- lib/src/lint.dart | 13 ++++-- lib/src/load.dart | 12 +++-- lib/src/parse.dart | 65 +++++++++++---------------- lib/src/types/commitlint.dart | 11 ++++- lib/src/types/parser.dart | 82 +++++++++++++++++++++++++++++++++++ test/parse_test.dart | 17 ++++++++ 6 files changed, 152 insertions(+), 48 deletions(-) create mode 100644 lib/src/types/parser.dart diff --git a/lib/src/lint.dart b/lib/src/lint.dart index 77873d7..4873c3c 100644 --- a/lib/src/lint.dart +++ b/lib/src/lint.dart @@ -3,20 +3,27 @@ import 'parse.dart'; import 'rules.dart'; import 'types/commit.dart'; import 'types/lint.dart'; +import 'types/parser.dart'; import 'types/rule.dart'; /// /// Lint commit [message] with configured [rules] /// -Future lint(String message, Map rules, - {bool? defaultIgnores, Iterable? ignores}) async { +Future lint( + String message, + Map rules, { + ParserOptions? parserOptions, + bool? defaultIgnores, + Iterable? ignores, +}) async { /// Found a wildcard match, skip if (isIgnored(message, defaultIgnores: defaultIgnores, ignores: ignores)) { return LintOutcome(input: message, valid: true, errors: [], warnings: []); } /// Parse the commit message - final commit = message.isEmpty ? Commit.empty() : parse(message); + final commit = + message.isEmpty ? Commit.empty() : parse(message, options: parserOptions); if (commit.header.isEmpty && commit.body == null && commit.footer == null) { /// Commit is empty, skip diff --git a/lib/src/load.dart b/lib/src/load.dart index 307fd2f..0155683 100644 --- a/lib/src/load.dart +++ b/lib/src/load.dart @@ -6,6 +6,7 @@ import 'package:yaml/yaml.dart'; import 'types/case.dart'; import 'types/commitlint.dart'; +import 'types/parser.dart'; import 'types/rule.dart'; /// @@ -31,11 +32,14 @@ Future load( final rules = yaml?['rules'] as YamlMap?; final ignores = yaml?['ignores'] as YamlList?; final defaultIgnores = yaml?['defaultIgnores'] as bool?; + final parser = yaml?['parser'] as YamlMap?; final config = CommitLint( - rules: rules?.map((key, value) => MapEntry(key, _extractRule(value))) ?? - {}, - ignores: ignores?.cast(), - defaultIgnores: defaultIgnores); + rules: + rules?.map((key, value) => MapEntry(key, _extractRule(value))) ?? {}, + ignores: ignores?.cast(), + defaultIgnores: defaultIgnores, + parser: parser != null ? ParserOptions.fromYaml(parser) : null, + ); if (include != null) { final upstream = await load(include, directory: file.parent); return config.inherit(upstream); diff --git a/lib/src/parse.dart b/lib/src/parse.dart index 3a646e3..ff70ed6 100644 --- a/lib/src/parse.dart +++ b/lib/src/parse.dart @@ -1,35 +1,14 @@ import 'types/commit.dart'; +import 'types/parser.dart'; /// /// Parse Commit Message String to Convensional Commit /// - -final _kHeaderPattern = - RegExp(r'^(?\w*?)(\((?.*)\))?!?: (?.+)$'); -const _kHeaderCorrespondence = ['type', 'scope', 'subject']; - -const _kReferenceActions = [ - 'close', - 'closes', - 'closed', - 'fix', - 'fixes', - 'fixed', - 'resolve', - 'resolves', - 'resolved' -]; - -const _kIssuePrefixes = ['#']; -const _kNoteKeywords = ['BREAKING CHANGE', 'BREAKING-CHANGE']; -final _kMergePattern = RegExp(r'^(Merge|merge)\s(.*)$'); -final _kRevertPattern = RegExp( - r'^(?:Revert|revert:)\s"?(?
[\s\S]+?)"?\s*This reverts commit (?\w*)\.'); -const _kRevertCorrespondence = ['header', 'hash']; - -final _kMentionsPattern = RegExp(r'@([\w-]+)'); - -Commit parse(String raw) { +Commit parse( + String raw, { + ParserOptions? options, +}) { + options ??= const ParserOptions(); if (raw.trim().isEmpty) { throw ArgumentError.value(raw, null, 'message raw must have content.'); } @@ -44,7 +23,7 @@ Commit parse(String raw) { final rawLines = _trimOffNewlines(raw).split(RegExp(r'\r?\n')); final lines = _truncateToScissor(rawLines).where(_gpgFilter).toList(); merge = lines.removeAt(0); - final mergeMatch = _kMergePattern.firstMatch(merge); + final mergeMatch = RegExp(options.mergePattern).firstMatch(merge); if (mergeMatch != null) { merge = mergeMatch.group(0); if (lines.isNotEmpty) { @@ -58,22 +37,27 @@ Commit parse(String raw) { header = merge; merge = null; } - final headerMatch = _kHeaderPattern.firstMatch(header); + final headerMatch = RegExp(options.headerPattern).firstMatch(header); final headerParts = {}; if (headerMatch != null) { - for (var name in _kHeaderCorrespondence) { - headerParts[name] = headerMatch.namedGroup(name); + for (int i = 0; i < options.headerCorrespondence.length; i++) { + final String key = options.headerCorrespondence[i]; + headerParts[key] = headerMatch.group(i + 1); } + // for (var name in options.headerCorrespondence) { + // headerParts[name] = headerMatch.namedGroup(name); + // } } - final referencesPattern = _getReferenceRegex(_kReferenceActions); - final referencePartsPattern = _getReferencePartsRegex(_kIssuePrefixes, false); + final referencesPattern = _getReferenceRegex(options.referenceActions); + final referencePartsPattern = + _getReferencePartsRegex(options.issuePrefixes, false); references.addAll(_getReferences(header, referencesPattern: referencesPattern, referencePartsPattern: referencePartsPattern)); bool continueNote = false; bool isBody = true; - final notesPattern = _getNotesRegex(_kNoteKeywords); + final notesPattern = _getNotesRegex(options.noteKeywords); /// body or footer for (var line in lines) { @@ -118,18 +102,19 @@ Commit parse(String raw) { } } - Match? mentionsMatch = _kMentionsPattern.firstMatch(raw); + final mentionsRegex = RegExp(options.mentionsPattern); + Match? mentionsMatch = mentionsRegex.firstMatch(raw); while (mentionsMatch != null) { mentions.add(mentionsMatch.group(1)!); - mentionsMatch = _kMentionsPattern.matchAsPrefix(raw, mentionsMatch.end); + mentionsMatch = mentionsRegex.matchAsPrefix(raw, mentionsMatch.end); } // does this commit revert any other commit? - final revertMatch = _kRevertPattern.firstMatch(raw); + final revertMatch = RegExp(options.revertPattern).firstMatch(raw); if (revertMatch != null) { revert = {}; - for (var i = 0; i < _kRevertCorrespondence.length; i++) { - revert[_kRevertCorrespondence[i]] = revertMatch.group(i + 1); + for (var i = 0; i < options.revertCorrespondence.length; i++) { + revert[options.revertCorrespondence[i]] = revertMatch.group(i + 1); } } @@ -141,7 +126,7 @@ Commit parse(String raw) { merge: merge, header: header, type: headerParts['type'], - scopes: headerParts['scope']?.split(RegExp(r'(/|,|\\)')), + scopes: headerParts['scope']?.split(RegExp(r'\/|\\|, ?')), subject: headerParts['subject'], body: body != null ? _trimOffNewlines(body) : null, footer: footer != null ? _trimOffNewlines(footer) : null, diff --git a/lib/src/types/commitlint.dart b/lib/src/types/commitlint.dart index 24d351b..8abd835 100644 --- a/lib/src/types/commitlint.dart +++ b/lib/src/types/commitlint.dart @@ -1,7 +1,13 @@ +import 'parser.dart'; import 'rule.dart'; class CommitLint { - CommitLint({this.rules = const {}, this.defaultIgnores, this.ignores}); + CommitLint({ + this.rules = const {}, + this.defaultIgnores, + this.ignores, + this.parser, + }); final Map rules; @@ -9,6 +15,8 @@ class CommitLint { final Iterable? ignores; + final ParserOptions? parser; + CommitLint inherit(CommitLint other) { return CommitLint( rules: { @@ -20,6 +28,7 @@ class CommitLint { ...?other.ignores, ...?ignores, ], + parser: parser ?? other.parser, ); } } diff --git a/lib/src/types/parser.dart b/lib/src/types/parser.dart new file mode 100644 index 0000000..e81b3e1 --- /dev/null +++ b/lib/src/types/parser.dart @@ -0,0 +1,82 @@ +import 'package:yaml/yaml.dart'; + +const _kHeaderPattern = + r'^(?\w*)(?:\((?.*)\))?!?: (?.*)$'; +const _kHeaderCorrespondence = ['type', 'scope', 'subject']; + +const _kReferenceActions = [ + 'close', + 'closes', + 'closed', + 'fix', + 'fixes', + 'fixed', + 'resolve', + 'resolves', + 'resolved' +]; + +const _kIssuePrefixes = ['#']; +const _kNoteKeywords = ['BREAKING CHANGE', 'BREAKING-CHANGE']; +const _kMergePattern = r'^(Merge|merge)\s(.*)$'; +const _kRevertPattern = + r'^(?:Revert|revert:)\s"?(?
[\s\S]+?)"?\s*This reverts commit (?\w*)\.'; +const _kRevertCorrespondence = ['header', 'hash']; + +const _kMentionsPattern = r'@([\w-]+)'; + +class ParserOptions { + final List issuePrefixes; + final List noteKeywords; + final List referenceActions; + final String headerPattern; + final List headerCorrespondence; + final String revertPattern; + final List revertCorrespondence; + final String mergePattern; + final String mentionsPattern; + + const ParserOptions({ + this.issuePrefixes = _kIssuePrefixes, + this.noteKeywords = _kNoteKeywords, + this.referenceActions = _kReferenceActions, + this.headerPattern = _kHeaderPattern, + this.headerCorrespondence = _kHeaderCorrespondence, + this.revertPattern = _kRevertPattern, + this.revertCorrespondence = _kRevertCorrespondence, + this.mergePattern = _kMergePattern, + this.mentionsPattern = _kMentionsPattern, + }); + + ParserOptions copyWith(ParserOptions? other) { + return ParserOptions( + issuePrefixes: other?.issuePrefixes ?? issuePrefixes, + noteKeywords: other?.noteKeywords ?? noteKeywords, + referenceActions: other?.referenceActions ?? referenceActions, + headerPattern: other?.headerPattern ?? headerPattern, + headerCorrespondence: other?.headerCorrespondence ?? headerCorrespondence, + revertPattern: other?.revertPattern ?? revertPattern, + revertCorrespondence: other?.revertCorrespondence ?? revertCorrespondence, + mergePattern: other?.mergePattern ?? mergePattern, + mentionsPattern: other?.mentionsPattern ?? mentionsPattern, + ); + } + + static ParserOptions fromYaml(YamlMap yaml) { + return ParserOptions( + issuePrefixes: + List.from(yaml['issuePrefixes'] ?? _kIssuePrefixes), + noteKeywords: List.from(yaml['noteKeywords'] ?? _kNoteKeywords), + referenceActions: + List.from(yaml['referenceActions'] ?? _kReferenceActions), + headerPattern: yaml['headerPattern'] ?? _kHeaderPattern, + headerCorrespondence: List.from( + yaml['headerCorrespondence'] ?? _kHeaderCorrespondence), + revertPattern: yaml['revertPattern'] ?? _kRevertPattern, + revertCorrespondence: List.from( + yaml['revertCorrespondence'] ?? _kRevertCorrespondence), + mergePattern: yaml['mergePattern'] ?? _kMergePattern, + mentionsPattern: yaml['mentionsPattern'] ?? _kMentionsPattern, + ); + } +} diff --git a/test/parse_test.dart b/test/parse_test.dart index 692131b..1cace6f 100644 --- a/test/parse_test.dart +++ b/test/parse_test.dart @@ -3,6 +3,7 @@ import 'package:collection/collection.dart'; import 'package:commitlint_cli/src/parse.dart'; import 'package:commitlint_cli/src/types/commit.dart'; +import 'package:commitlint_cli/src/types/parser.dart'; import 'package:test/test.dart'; void main() { @@ -255,6 +256,22 @@ void main() { expect(commit.body, equals('this is some body before a scissors-line')); }); + test('should use custom parser options with headerPattern', () { + final commit = parse('type(scope)-subject', + options: ParserOptions(headerPattern: r'^(\w*)(?:\((.*)\))?-(.*)$')); + expect(commit.header, equals('type(scope)-subject')); + expect(commit.scopes, equals(['scope'])); + expect(commit.subject, equals('subject')); + expect(commit.type, equals('type')); + }); + + test('should use custom parser options with custom issuePrefixes', () { + final commit = parse('fix: change git convention to fix CD workflow sv-4', + options: ParserOptions(issuePrefixes: ['sv-'])); + expect(commit.type, equals('fix')); + expect(commit.references.first.issue, equals('4')); + }); + group('merge commits', () { final githubCommit = parse( 'Merge pull request #1 from user/feature/feature-name\n' + From 3cee793a60e2b2be0f8063fd284fc78450416052 Mon Sep 17 00:00:00 2001 From: hyiso Date: Mon, 11 Nov 2024 15:14:41 +0800 Subject: [PATCH 19/21] chore(release): release 0.8.0 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df40ab..40061c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.0 + + - Support parser options in `commitlint.yaml` under section `parser` + ## 0.7.2 - ignoring mulitline merge commit message (fix #20) diff --git a/pubspec.yaml b/pubspec.yaml index 9165ed4..37405e1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: commitlint_cli description: Commitlint lint commit messages to satisfy conventional commit format -version: 0.7.2 +version: 0.8.0 homepage: https://github.com/hyiso/commitlint documentation: https://hyiso.github.io/commitlint From c370674ef4283387dc800c1de40dd30a33c8815f Mon Sep 17 00:00:00 2001 From: hyiso Date: Wed, 13 Nov 2024 18:52:59 +0800 Subject: [PATCH 20/21] fix: `parserOptions` not passed to `lint`(fix #23) --- lib/src/runner.dart | 11 ++++++--- test/__fixtures__/parser-options.yaml | 34 +++++++++++++++++++++++++++ test/lint_test.dart | 11 +++++++++ test/load_test.dart | 5 ++++ 4 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 test/__fixtures__/parser-options.yaml diff --git a/lib/src/runner.dart b/lib/src/runner.dart index 0dfd5c8..2ca24f6 100644 --- a/lib/src/runner.dart +++ b/lib/src/runner.dart @@ -45,9 +45,14 @@ class CommitLintRunner extends CommandRunner { final messages = fromStdin ? await _stdin() : await read(from: from, to: to, edit: edit); final config = await load(topLevelResults['config']); - final results = (await Future.wait(messages.map((message) async => - await lint(message, config.rules, - defaultIgnores: config.defaultIgnores, ignores: config.ignores)))); + final results = + (await Future.wait(messages.map((message) async => await lint( + message, + config.rules, + parserOptions: config.parser, + defaultIgnores: config.defaultIgnores, + ignores: config.ignores, + )))); if (config.rules.isEmpty) { String input = ''; if (results.isNotEmpty) { diff --git a/test/__fixtures__/parser-options.yaml b/test/__fixtures__/parser-options.yaml new file mode 100644 index 0000000..b0157b4 --- /dev/null +++ b/test/__fixtures__/parser-options.yaml @@ -0,0 +1,34 @@ +# https://github.com/hyiso/commitlint/blob/main/lib/commitlint.yaml +include: package:commitlint_cli/commitlint.yaml + +# https://github.com/hyiso/commitlint/pull/22 +parser: + issuePrefixes: + - "sv-" + +# https://hyiso.github.io/commitlint/#/references-rules +rules: + type-enum: + - 2 + - always + - - build + - chore + - docs + - feat + - fix + - refactor + - revert + - style + - test + scope-enum: + - 2 + - always + - - domain + - infrastructures + - use_cases + - interfaces + - lib + - root + references-empty: + - 2 + - never \ No newline at end of file diff --git a/test/lint_test.dart b/test/lint_test.dart index c8b6237..72388c3 100644 --- a/test/lint_test.dart +++ b/test/lint_test.dart @@ -1,4 +1,5 @@ import 'package:commitlint_cli/src/lint.dart'; +import 'package:commitlint_cli/src/load.dart'; import 'package:commitlint_cli/src/types/rule.dart'; import 'package:test/test.dart'; @@ -138,4 +139,14 @@ Signed-off-by: dependabot[bot] expect(result.valid, true); expect(result.input, equals(message)); }); + + test('should use custom parser options with custom issuePrefixes', () async { + final config = await load('test/__fixtures__/parser-options.yaml'); + final result = await lint( + 'fix(root): fix commitlint config sv-1', + config.rules, + parserOptions: config.parser, + ); + expect(result.valid, true); + }); } diff --git a/test/load_test.dart b/test/load_test.dart index c34b837..5700365 100644 --- a/test/load_test.dart +++ b/test/load_test.dart @@ -40,4 +40,9 @@ void main() { expect(config.defaultIgnores, equals(null)); expect(config.ignores, equals(["r'^fixup'"])); }); + test('custom parser options should work', () async { + final config = await load('test/__fixtures__/parser-options.yaml'); + expect(config.parser, isNotNull); + expect(config.parser!.issuePrefixes, equals(['sv-'])); + }); } From eaad24cb94e227ccb6554c577af07673c453f72b Mon Sep 17 00:00:00 2001 From: hyiso Date: Wed, 13 Nov 2024 18:53:03 +0800 Subject: [PATCH 21/21] chore(release): release 0.8.1 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40061c1..282fe76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.1 + + - Fix `parserOptions` not passed to `lint` + ## 0.8.0 - Support parser options in `commitlint.yaml` under section `parser` diff --git a/pubspec.yaml b/pubspec.yaml index 37405e1..1a06ea8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: commitlint_cli description: Commitlint lint commit messages to satisfy conventional commit format -version: 0.8.0 +version: 0.8.1 homepage: https://github.com/hyiso/commitlint documentation: https://hyiso.github.io/commitlint