Skip to content

Commit

Permalink
Add tests for prefer-match-file-name rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Bogatirov committed Sep 20, 2023
1 parent 0674bc1 commit fe74a14
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 11 deletions.
1 change: 1 addition & 0 deletions lint_test/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ custom_lint:
- prefer-conditional-expressions
- prefer-first
- prefer-last
- prefer-match-file-name
2 changes: 1 addition & 1 deletion lint_test/avoid_global_state_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: type_annotate_public_apis
// ignore_for_file: type_annotate_public_apis, prefer-match-file-name

/// Check global mutable variable fail
/// `avoid_global_state`
Expand Down
2 changes: 1 addition & 1 deletion lint_test/avoid_late_keyword_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: prefer_const_declarations, unused_local_variable
// ignore_for_file: prefer_const_declarations, unused_local_variable, prefer-match-file-name
// ignore_for_file: avoid_global_state

/// Check "late" keyword fail
Expand Down
2 changes: 1 addition & 1 deletion lint_test/avoid_non_null_assertion_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: avoid_global_state
// ignore_for_file: avoid_global_state, prefer-match-file-name
// ignore_for_file: member-ordering

/// Check "bang" operator fail
Expand Down
2 changes: 1 addition & 1 deletion lint_test/avoid_returning_widget_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: unused_element
// ignore_for_file: unused_element, prefer-match-file-name
// ignore_for_file: member-ordering

/// Check returning a widget fail
Expand Down
2 changes: 1 addition & 1 deletion lint_test/avoid_unnecessary_setstate_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

// ignore_for_file: member-ordering
// ignore_for_file: member-ordering, prefer-match-file-name

import 'package:flutter/material.dart';

Expand Down
2 changes: 1 addition & 1 deletion lint_test/avoid_unrelated_type_assertions_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: prefer_const_declarations
// ignore_for_file: prefer_const_declarations, prefer-match-file-name
// ignore_for_file: unnecessary_nullable_for_final_variable_declarations
// ignore_for_file: unused_local_variable

Expand Down
2 changes: 1 addition & 1 deletion lint_test/avoid_unused_parameters_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: prefer_const_declarations
// ignore_for_file: prefer_const_declarations, prefer-match-file-name
// ignore_for_file: unnecessary_nullable_for_final_variable_declarations
// ignore_for_file: unused_local_variable
// ignore_for_file: unused_element
Expand Down
2 changes: 1 addition & 1 deletion lint_test/member_ordering_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: unused_field
// ignore_for_file: unused_field, prefer-match-file-name
// ignore_for_file: unused_element
// ignore_for_file: no-empty-block

Expand Down
2 changes: 1 addition & 1 deletion lint_test/newline_before_return_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: unused_local_variable
// ignore_for_file: unused_local_variable, prefer-match-file-name
// ignore_for_file: member-ordering
// ignore_for_file: avoid-unused-parameters

Expand Down
2 changes: 1 addition & 1 deletion lint_test/no_empty_block_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: prefer_const_declarations
// ignore_for_file: prefer_const_declarations, prefer-match-file-name
// ignore_for_file: unused_local_variable
// ignore_for_file: cyclomatic_complexity
// ignore_for_file: avoid-unused-parameters
Expand Down
2 changes: 1 addition & 1 deletion lint_test/no_magic_number_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: unused_local_variable
// ignore_for_file: unused_local_variable, prefer-match-file-name

/// Check the `no-magic-number` rule
Expand Down
5 changes: 5 additions & 0 deletions lint_test/prefer_match_file_name_enum_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// ignore_for_file: unused_element, unused_field

/// Check the `prefer-match-file-name` rule
// expect_lint: prefer-match-file-name
enum WrongMixin { a, b }
5 changes: 5 additions & 0 deletions lint_test/prefer_match_file_name_extension_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// ignore_for_file: unused_element, unused_field

/// Check the `prefer-match-file-name` rule
// expect_lint: prefer-match-file-name
extension WrongExtension on List {}
5 changes: 5 additions & 0 deletions lint_test/prefer_match_file_name_mixin_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// ignore_for_file: unused_element, unused_field

/// Check the `prefer-match-file-name` rule
// expect_lint: prefer-match-file-name
mixin WrongMixin {}
17 changes: 17 additions & 0 deletions lint_test/prefer_match_file_name_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ignore_for_file: unused_element, unused_field

/// Check the `prefer-match-file-name` rule
class _AnotherPrivateClass {}

class PreferMatchFileNameTest {}

/// Only first public element declaration is checked
class WrongClass {}

class _PrivateClass {}

extension _PrivateExtension on PreferMatchFileNameTest {}

enum _PrivateEnum { a, b }

mixin _PrivateMixin {}
10 changes: 10 additions & 0 deletions lint_test/prefer_match_file_name_wrong_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// ignore_for_file: unused_element, unused_field

/// Check the `prefer-match-file-name` rule
class _AnotherPrivateClass {}

// expect_lint: prefer-match-file-name
class WrongClass {}

/// Only first public element declaration is checked
class PreferMatchFileNameWrongTest {}

0 comments on commit fe74a14

Please sign in to comment.