Skip to content

Commit

Permalink
fixup! feat: add rule for final_defined_class
Browse files Browse the repository at this point in the history
  • Loading branch information
ostk0069 committed Mar 9, 2025
1 parent b284923 commit a25f3af
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/nilts/lib/src/lints/final_defined_class.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ final class FinalDefinedClass extends DartLintRule {

static const _code = LintCode(
name: 'final_defined_class',
problemMessage:
'Classes should be marked as final if they are not intended to be extended.',
problemMessage: 'Please add the final keyword to the class declaration.',
correctionMessage: 'Try adding the final keyword to the class declaration.',
url: 'https://github.com/dassssshers/nilts#prefer_final_class',
);
Expand All @@ -41,8 +40,7 @@ final class FinalDefinedClass extends DartLintRule {
CustomLintContext context,
) {
context.registry.addClassDeclaration((node) {
// 既にfinalが付いている場合はスキップ
if (node.metadata.any((m) => m.name.name == 'sealed') ||
if (node.sealedKeyword != null ||
node.abstractKeyword != null ||
node.finalKeyword != null ||
node.baseKeyword != null ||
Expand All @@ -59,7 +57,9 @@ final class FinalDefinedClass extends DartLintRule {
}

@override
List<Fix> getFixes() => [_AddFinalKeyword()];
List<Fix> getFixes() => [
_AddFinalKeyword(),
];
}

final class _AddFinalKeyword extends DartFix {
Expand Down

0 comments on commit a25f3af

Please sign in to comment.