Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

fix: ignore doc comments for prefer-commenting-analyzer-ignores #1115

Merged
merged 1 commit into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* feat: add `strict` config option to [`avoid-collection-methods-with-unrelated-types`](https://dartcodemetrics.dev/docs/rules/common/avoid-collection-methods-with-unrelated-types).
* fix: support function expression invocations for [`prefer-moving-to-variable`](https://dartcodemetrics.dev/docs/rules/common/prefer-moving-to-variable).
* feat: support ignoring regular comments for [`format-comment`](https://dartcodemetrics.dev/docs/rules/common/format-comment).
* fix: ignore doc comments for [`prefer-commenting-analyzer-ignores`](https://dartcodemetrics.dev/docs/rules/common/prefer-commenting-analyzer-ignores).

## 5.2.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class _Visitor extends RecursiveAstVisitor<void> {
final previous = node.previous;

return previous == null ||
(previous.type != TokenType.SINGLE_LINE_COMMENT ||
((previous.type != TokenType.SINGLE_LINE_COMMENT ||
previous.toString().startsWith('///')) ||
_lineInfo.getLocation(node.offset).lineNumber - 1 !=
_lineInfo.getLocation(previous.offset).lineNumber);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ void main() {

// ignore: avoid-non-null-assertion, checked for non-null
final hashMap = HashMap();

/// documentation comment
// ignore: avoid-non-null-assertion
final value = 1; // LINT
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ void main() {

RuleTestHelper.verifyIssues(
issues: issues,
startLines: [3, 6],
startColumns: [3, 3],
startLines: [3, 6, 23],
startColumns: [3, 3, 3],
locationTexts: [
'// ignore: deprecated_member_use',
'// ignore: deprecated_member_use, long-method',
'// ignore: avoid-non-null-assertion',
],
messages: [
'Prefer commenting analyzer ignores.',
'Prefer commenting analyzer ignores.',
'Prefer commenting analyzer ignores.',
],
);
});
Expand Down