This repository was archived by the owner on Jul 16, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
lib/src/analyzers/lint_analyzer/rules/rules_list/prefer_match_file_name
test/analyzers/lint_analyzer/rules/rules_list/prefer_match_file_name Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ class PreferMatchFileName extends CommonRule {
3434 className.replaceAll (_onlySymbolsRegex, '' ).toLowerCase ();
3535
3636 return classNameFormatted ==
37- basenameWithoutExtension (path)
37+ basename (path)
38+ .split ('.' )
39+ .first
3840 .replaceAll (_onlySymbolsRegex, '' )
3941 .toLowerCase ();
4042 }
Original file line number Diff line number Diff line change 1+ class SomeWidget extends StatelessWidget {
2+ @override
3+ Widget build (BuildContext context) {
4+ //...
5+ }
6+ }
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ const _withIssue = '$_examplePath/example_with_issue.dart';
1212const _emptyFile = '$_examplePath /empty_file.dart' ;
1313const _privateClass = '$_examplePath /private_class.dart' ;
1414const _multiClass = '$_examplePath /multiple_classes_example.dart' ;
15+ const _codegenFile = '$_examplePath /some_widget.codegen.dart' ;
1516
1617void main () {
1718 group ('PreferMatchFileName' , () {
@@ -75,5 +76,12 @@ void main() {
7576
7677 RuleTestHelper .verifyNoIssues (issues);
7778 });
79+
80+ test ('reports no issues for codegen file' , () async {
81+ final unit = await RuleTestHelper .resolveFromFile (_codegenFile);
82+ final issues = PreferMatchFileName ().check (unit);
83+
84+ RuleTestHelper .verifyNoIssues (issues);
85+ });
7886 });
7987}
You can’t perform that action at this time.
0 commit comments