From 68139394d3251ff7f5c6d5519e582d5b147f2dbf Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 29 Apr 2024 14:11:33 +0300 Subject: [PATCH] Refactor package structure --- lib/solid_lints.dart | 12 ++++++------ .../avoid_final_with_getter_rule.dart | 2 +- .../{ => fixes}/avoid_final_with_getter_fix.dart | 2 +- .../avoid_unnecessary_set_state_rule.dart | 2 +- .../avoid_unnecessary_set_state_method_visitor.dart | 0 .../avoid_unnecessary_set_state_visitor.dart | 2 +- .../avoid_unnecessary_type_assertions_rule.dart | 2 +- .../avoid_unnecessary_type_assertions_fix.dart | 2 +- .../avoid_unnecessary_type_casts_rule.dart | 4 ++-- .../avoid_unnecessary_type_casts_fix.dart | 2 +- .../avoid_unnecessary_type_casts_visitor.dart | 0 .../avoid_unrelated_type_assertions_rule.dart | 2 +- .../avoid_unrelated_type_assertions_visitor.dart | 0 .../avoid_unused_parameters_rule.dart | 2 +- .../avoid_unused_parameters_visitor.dart | 0 ...y_metric.dart => cyclomatic_complexity_rule.dart} | 12 ++++++------ .../cyclomatic_complexity_flow_visitor.dart | 0 .../double_literal_format_rule.dart | 2 +- .../{ => fixes}/double_literal_format_fix.dart | 2 +- ..._metric.dart => function_lines_of_code_rule.dart} | 12 ++++++------ .../function_lines_of_code_visitor.dart | 0 .../lints/member_ordering/member_ordering_rule.dart | 2 +- .../{ => visitors}/member_ordering_visitor.dart | 0 .../newline_before_return_rule.dart | 2 +- .../newline_before_return_visitor.dart | 0 .../lints/no_empty_block/no_empty_block_rule.dart | 2 +- .../{ => visitors}/no_empty_block_visitor.dart | 0 .../no_equal_then_else/no_equal_then_else_rule.dart | 2 +- .../{ => visitors}/no_equal_then_else_visitor.dart | 0 .../lints/no_magic_number/no_magic_number_rule.dart | 2 +- .../{ => visitors}/no_magic_number_visitor.dart | 0 ...rs_metric.dart => number_of_parameters_rule.dart} | 10 +++++----- .../prefer_conditional_expressions_fix.dart | 2 +- .../prefer_conditional_expressions_rule.dart | 4 ++-- .../prefer_conditional_expressions_visitor.dart | 0 .../prefer_first/{ => fixes}/prefer_first_fix.dart | 0 lib/src/lints/prefer_first/prefer_first_rule.dart | 4 ++-- .../{ => visitors}/prefer_first_visitor.dart | 0 .../prefer_last/{ => fixes}/prefer_last_fix.dart | 0 lib/src/lints/prefer_last/prefer_last_rule.dart | 4 ++-- .../{ => visitors}/prefer_last_visitor.dart | 0 .../prefer_match_file_name_rule.dart | 2 +- .../prefer_match_file_name_visitor.dart | 0 43 files changed, 49 insertions(+), 49 deletions(-) rename lib/src/lints/avoid_final_with_getter/{ => fixes}/avoid_final_with_getter_fix.dart (95%) rename lib/src/lints/avoid_unnecessary_setstate/{visitor => visitors}/avoid_unnecessary_set_state_method_visitor.dart (100%) rename lib/src/lints/avoid_unnecessary_setstate/{visitor => visitors}/avoid_unnecessary_set_state_visitor.dart (98%) rename lib/src/lints/avoid_unnecessary_type_assertions/{ => fixes}/avoid_unnecessary_type_assertions_fix.dart (95%) rename lib/src/lints/avoid_unnecessary_type_casts/{ => fixes}/avoid_unnecessary_type_casts_fix.dart (95%) rename lib/src/lints/avoid_unnecessary_type_casts/{ => visitors}/avoid_unnecessary_type_casts_visitor.dart (100%) rename lib/src/lints/avoid_unrelated_type_assertions/{ => visitors}/avoid_unrelated_type_assertions_visitor.dart (100%) rename lib/src/lints/avoid_unused_parameters/{ => visitors}/avoid_unused_parameters_visitor.dart (100%) rename lib/src/lints/cyclomatic_complexity/{cyclomatic_complexity_metric.dart => cyclomatic_complexity_rule.dart} (85%) rename lib/src/lints/cyclomatic_complexity/{visitor => visitors}/cyclomatic_complexity_flow_visitor.dart (100%) rename lib/src/lints/double_literal_format/{ => fixes}/double_literal_format_fix.dart (97%) rename lib/src/lints/function_lines_of_code/{function_lines_of_code_metric.dart => function_lines_of_code_rule.dart} (90%) rename lib/src/lints/function_lines_of_code/{visitor => visitors}/function_lines_of_code_visitor.dart (100%) rename lib/src/lints/member_ordering/{ => visitors}/member_ordering_visitor.dart (100%) rename lib/src/lints/newline_before_return/{ => visitors}/newline_before_return_visitor.dart (100%) rename lib/src/lints/no_empty_block/{ => visitors}/no_empty_block_visitor.dart (100%) rename lib/src/lints/no_equal_then_else/{ => visitors}/no_equal_then_else_visitor.dart (100%) rename lib/src/lints/no_magic_number/{ => visitors}/no_magic_number_visitor.dart (100%) rename lib/src/lints/number_of_parameters/{number_of_parameters_metric.dart => number_of_parameters_rule.dart} (89%) rename lib/src/lints/prefer_conditional_expressions/{ => fixes}/prefer_conditional_expressions_fix.dart (98%) rename lib/src/lints/prefer_conditional_expressions/{ => visitors}/prefer_conditional_expressions_visitor.dart (100%) rename lib/src/lints/prefer_first/{ => fixes}/prefer_first_fix.dart (100%) rename lib/src/lints/prefer_first/{ => visitors}/prefer_first_visitor.dart (100%) rename lib/src/lints/prefer_last/{ => fixes}/prefer_last_fix.dart (100%) rename lib/src/lints/prefer_last/{ => visitors}/prefer_last_visitor.dart (100%) rename lib/src/lints/prefer_match_file_name/{ => visitors}/prefer_match_file_name_visitor.dart (100%) diff --git a/lib/solid_lints.dart b/lib/solid_lints.dart index 814ea8ba..0e7f7b09 100644 --- a/lib/solid_lints.dart +++ b/lib/solid_lints.dart @@ -13,15 +13,15 @@ import 'package:solid_lints/src/lints/avoid_unnecessary_type_casts/avoid_unneces import 'package:solid_lints/src/lints/avoid_unrelated_type_assertions/avoid_unrelated_type_assertions_rule.dart'; import 'package:solid_lints/src/lints/avoid_unused_parameters/avoid_unused_parameters_rule.dart'; import 'package:solid_lints/src/lints/avoid_using_api/avoid_using_api_rule.dart'; -import 'package:solid_lints/src/lints/cyclomatic_complexity/cyclomatic_complexity_metric.dart'; +import 'package:solid_lints/src/lints/cyclomatic_complexity/cyclomatic_complexity_rule.dart'; import 'package:solid_lints/src/lints/double_literal_format/double_literal_format_rule.dart'; -import 'package:solid_lints/src/lints/function_lines_of_code/function_lines_of_code_metric.dart'; +import 'package:solid_lints/src/lints/function_lines_of_code/function_lines_of_code_rule.dart'; import 'package:solid_lints/src/lints/member_ordering/member_ordering_rule.dart'; import 'package:solid_lints/src/lints/newline_before_return/newline_before_return_rule.dart'; import 'package:solid_lints/src/lints/no_empty_block/no_empty_block_rule.dart'; import 'package:solid_lints/src/lints/no_equal_then_else/no_equal_then_else_rule.dart'; import 'package:solid_lints/src/lints/no_magic_number/no_magic_number_rule.dart'; -import 'package:solid_lints/src/lints/number_of_parameters/number_of_parameters_metric.dart'; +import 'package:solid_lints/src/lints/number_of_parameters/number_of_parameters_rule.dart'; import 'package:solid_lints/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_rule.dart'; import 'package:solid_lints/src/lints/prefer_early_return/prefer_early_return_rule.dart'; import 'package:solid_lints/src/lints/prefer_first/prefer_first_rule.dart'; @@ -38,9 +38,9 @@ class _SolidLints extends PluginBase { @override List getLintRules(CustomLintConfigs configs) { final List supportedRules = [ - CyclomaticComplexityMetric.createRule(configs), - NumberOfParametersMetric.createRule(configs), - FunctionLinesOfCodeMetric.createRule(configs), + CyclomaticComplexityRule.createRule(configs), + NumberOfParametersRule.createRule(configs), + FunctionLinesOfCodeRule.createRule(configs), AvoidNonNullAssertionRule.createRule(configs), AvoidLateKeywordRule.createRule(configs), AvoidGlobalStateRule.createRule(configs), diff --git a/lib/src/lints/avoid_final_with_getter/avoid_final_with_getter_rule.dart b/lib/src/lints/avoid_final_with_getter/avoid_final_with_getter_rule.dart index 7e9d24f8..497faa27 100644 --- a/lib/src/lints/avoid_final_with_getter/avoid_final_with_getter_rule.dart +++ b/lib/src/lints/avoid_final_with_getter/avoid_final_with_getter_rule.dart @@ -6,7 +6,7 @@ import 'package:solid_lints/src/lints/avoid_final_with_getter/visitors/avoid_fin import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; -part 'avoid_final_with_getter_fix.dart'; +part 'fixes/avoid_final_with_getter_fix.dart'; /// Avoid using final private fields with getters. /// diff --git a/lib/src/lints/avoid_final_with_getter/avoid_final_with_getter_fix.dart b/lib/src/lints/avoid_final_with_getter/fixes/avoid_final_with_getter_fix.dart similarity index 95% rename from lib/src/lints/avoid_final_with_getter/avoid_final_with_getter_fix.dart rename to lib/src/lints/avoid_final_with_getter/fixes/avoid_final_with_getter_fix.dart index 47aefc0a..0d714b67 100644 --- a/lib/src/lints/avoid_final_with_getter/avoid_final_with_getter_fix.dart +++ b/lib/src/lints/avoid_final_with_getter/fixes/avoid_final_with_getter_fix.dart @@ -1,4 +1,4 @@ -part of 'avoid_final_with_getter_rule.dart'; +part of '../avoid_final_with_getter_rule.dart'; class _FinalWithGetterFix extends DartFix { @override diff --git a/lib/src/lints/avoid_unnecessary_setstate/avoid_unnecessary_set_state_rule.dart b/lib/src/lints/avoid_unnecessary_setstate/avoid_unnecessary_set_state_rule.dart index b964bad5..a0cea2bd 100644 --- a/lib/src/lints/avoid_unnecessary_setstate/avoid_unnecessary_set_state_rule.dart +++ b/lib/src/lints/avoid_unnecessary_setstate/avoid_unnecessary_set_state_rule.dart @@ -1,6 +1,6 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/avoid_unnecessary_setstate/visitor/avoid_unnecessary_set_state_visitor.dart'; +import 'package:solid_lints/src/lints/avoid_unnecessary_setstate/visitors/avoid_unnecessary_set_state_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/avoid_unnecessary_setstate/visitor/avoid_unnecessary_set_state_method_visitor.dart b/lib/src/lints/avoid_unnecessary_setstate/visitors/avoid_unnecessary_set_state_method_visitor.dart similarity index 100% rename from lib/src/lints/avoid_unnecessary_setstate/visitor/avoid_unnecessary_set_state_method_visitor.dart rename to lib/src/lints/avoid_unnecessary_setstate/visitors/avoid_unnecessary_set_state_method_visitor.dart diff --git a/lib/src/lints/avoid_unnecessary_setstate/visitor/avoid_unnecessary_set_state_visitor.dart b/lib/src/lints/avoid_unnecessary_setstate/visitors/avoid_unnecessary_set_state_visitor.dart similarity index 98% rename from lib/src/lints/avoid_unnecessary_setstate/visitor/avoid_unnecessary_set_state_visitor.dart rename to lib/src/lints/avoid_unnecessary_setstate/visitors/avoid_unnecessary_set_state_visitor.dart index 49b22d0a..5679d5e8 100644 --- a/lib/src/lints/avoid_unnecessary_setstate/visitor/avoid_unnecessary_set_state_visitor.dart +++ b/lib/src/lints/avoid_unnecessary_setstate/visitors/avoid_unnecessary_set_state_visitor.dart @@ -24,7 +24,7 @@ import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/visitor.dart'; import 'package:collection/collection.dart'; -import 'package:solid_lints/src/lints/avoid_unnecessary_setstate/visitor/avoid_unnecessary_set_state_method_visitor.dart'; +import 'package:solid_lints/src/lints/avoid_unnecessary_setstate/visitors/avoid_unnecessary_set_state_method_visitor.dart'; import 'package:solid_lints/src/utils/types_utils.dart'; /// AST visitor which checks if class is State, in case yes checks its methods diff --git a/lib/src/lints/avoid_unnecessary_type_assertions/avoid_unnecessary_type_assertions_rule.dart b/lib/src/lints/avoid_unnecessary_type_assertions/avoid_unnecessary_type_assertions_rule.dart index 3efef221..fa5fe38d 100644 --- a/lib/src/lints/avoid_unnecessary_type_assertions/avoid_unnecessary_type_assertions_rule.dart +++ b/lib/src/lints/avoid_unnecessary_type_assertions/avoid_unnecessary_type_assertions_rule.dart @@ -9,7 +9,7 @@ import 'package:solid_lints/src/models/solid_lint_rule.dart'; import 'package:solid_lints/src/utils/typecast_utils.dart'; import 'package:solid_lints/src/utils/types_utils.dart'; -part 'avoid_unnecessary_type_assertions_fix.dart'; +part 'fixes/avoid_unnecessary_type_assertions_fix.dart'; /// The name of 'is' operator const operatorIsName = 'is'; diff --git a/lib/src/lints/avoid_unnecessary_type_assertions/avoid_unnecessary_type_assertions_fix.dart b/lib/src/lints/avoid_unnecessary_type_assertions/fixes/avoid_unnecessary_type_assertions_fix.dart similarity index 95% rename from lib/src/lints/avoid_unnecessary_type_assertions/avoid_unnecessary_type_assertions_fix.dart rename to lib/src/lints/avoid_unnecessary_type_assertions/fixes/avoid_unnecessary_type_assertions_fix.dart index 884003df..90c1c91d 100644 --- a/lib/src/lints/avoid_unnecessary_type_assertions/avoid_unnecessary_type_assertions_fix.dart +++ b/lib/src/lints/avoid_unnecessary_type_assertions/fixes/avoid_unnecessary_type_assertions_fix.dart @@ -1,4 +1,4 @@ -part of 'avoid_unnecessary_type_assertions_rule.dart'; +part of '../avoid_unnecessary_type_assertions_rule.dart'; /// A Quick fix for `avoid_unnecessary_type_assertions` rule /// Suggests to remove unnecessary assertions diff --git a/lib/src/lints/avoid_unnecessary_type_casts/avoid_unnecessary_type_casts_rule.dart b/lib/src/lints/avoid_unnecessary_type_casts/avoid_unnecessary_type_casts_rule.dart index cc8d6009..a66cc799 100644 --- a/lib/src/lints/avoid_unnecessary_type_casts/avoid_unnecessary_type_casts_rule.dart +++ b/lib/src/lints/avoid_unnecessary_type_casts/avoid_unnecessary_type_casts_rule.dart @@ -3,11 +3,11 @@ import 'package:analyzer/error/error.dart'; import 'package:analyzer/error/listener.dart'; import 'package:analyzer/source/source_range.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/avoid_unnecessary_type_casts/avoid_unnecessary_type_casts_visitor.dart'; +import 'package:solid_lints/src/lints/avoid_unnecessary_type_casts/visitors/avoid_unnecessary_type_casts_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; -part 'avoid_unnecessary_type_casts_fix.dart'; +part 'fixes/avoid_unnecessary_type_casts_fix.dart'; /// An `avoid_unnecessary_type_casts` rule which /// warns about unnecessary usage of `as` operator diff --git a/lib/src/lints/avoid_unnecessary_type_casts/avoid_unnecessary_type_casts_fix.dart b/lib/src/lints/avoid_unnecessary_type_casts/fixes/avoid_unnecessary_type_casts_fix.dart similarity index 95% rename from lib/src/lints/avoid_unnecessary_type_casts/avoid_unnecessary_type_casts_fix.dart rename to lib/src/lints/avoid_unnecessary_type_casts/fixes/avoid_unnecessary_type_casts_fix.dart index 47435f50..79345a7e 100644 --- a/lib/src/lints/avoid_unnecessary_type_casts/avoid_unnecessary_type_casts_fix.dart +++ b/lib/src/lints/avoid_unnecessary_type_casts/fixes/avoid_unnecessary_type_casts_fix.dart @@ -1,4 +1,4 @@ -part of 'avoid_unnecessary_type_casts_rule.dart'; +part of '../avoid_unnecessary_type_casts_rule.dart'; /// A Quick fix for `avoid_unnecessary_type_casts` rule /// Suggests to remove unnecessary assertions diff --git a/lib/src/lints/avoid_unnecessary_type_casts/avoid_unnecessary_type_casts_visitor.dart b/lib/src/lints/avoid_unnecessary_type_casts/visitors/avoid_unnecessary_type_casts_visitor.dart similarity index 100% rename from lib/src/lints/avoid_unnecessary_type_casts/avoid_unnecessary_type_casts_visitor.dart rename to lib/src/lints/avoid_unnecessary_type_casts/visitors/avoid_unnecessary_type_casts_visitor.dart diff --git a/lib/src/lints/avoid_unrelated_type_assertions/avoid_unrelated_type_assertions_rule.dart b/lib/src/lints/avoid_unrelated_type_assertions/avoid_unrelated_type_assertions_rule.dart index 1d5d4b78..4be90716 100644 --- a/lib/src/lints/avoid_unrelated_type_assertions/avoid_unrelated_type_assertions_rule.dart +++ b/lib/src/lints/avoid_unrelated_type_assertions/avoid_unrelated_type_assertions_rule.dart @@ -1,6 +1,6 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/avoid_unrelated_type_assertions/avoid_unrelated_type_assertions_visitor.dart'; +import 'package:solid_lints/src/lints/avoid_unrelated_type_assertions/visitors/avoid_unrelated_type_assertions_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/avoid_unrelated_type_assertions/avoid_unrelated_type_assertions_visitor.dart b/lib/src/lints/avoid_unrelated_type_assertions/visitors/avoid_unrelated_type_assertions_visitor.dart similarity index 100% rename from lib/src/lints/avoid_unrelated_type_assertions/avoid_unrelated_type_assertions_visitor.dart rename to lib/src/lints/avoid_unrelated_type_assertions/visitors/avoid_unrelated_type_assertions_visitor.dart diff --git a/lib/src/lints/avoid_unused_parameters/avoid_unused_parameters_rule.dart b/lib/src/lints/avoid_unused_parameters/avoid_unused_parameters_rule.dart index e48a3116..be52d0eb 100644 --- a/lib/src/lints/avoid_unused_parameters/avoid_unused_parameters_rule.dart +++ b/lib/src/lints/avoid_unused_parameters/avoid_unused_parameters_rule.dart @@ -1,6 +1,6 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/avoid_unused_parameters/avoid_unused_parameters_visitor.dart'; +import 'package:solid_lints/src/lints/avoid_unused_parameters/visitors/avoid_unused_parameters_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/avoid_unused_parameters/avoid_unused_parameters_visitor.dart b/lib/src/lints/avoid_unused_parameters/visitors/avoid_unused_parameters_visitor.dart similarity index 100% rename from lib/src/lints/avoid_unused_parameters/avoid_unused_parameters_visitor.dart rename to lib/src/lints/avoid_unused_parameters/visitors/avoid_unused_parameters_visitor.dart diff --git a/lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_metric.dart b/lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_rule.dart similarity index 85% rename from lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_metric.dart rename to lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_rule.dart index 9fc8a8e6..86a2570c 100644 --- a/lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_metric.dart +++ b/lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_rule.dart @@ -1,7 +1,7 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; import 'package:solid_lints/src/lints/cyclomatic_complexity/models/cyclomatic_complexity_parameters.dart'; -import 'package:solid_lints/src/lints/cyclomatic_complexity/visitor/cyclomatic_complexity_flow_visitor.dart'; +import 'package:solid_lints/src/lints/cyclomatic_complexity/visitors/cyclomatic_complexity_flow_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; @@ -22,17 +22,17 @@ import 'package:solid_lints/src/models/solid_lint_rule.dart'; /// - cyclomatic_complexity: /// max_complexity: 10 /// ``` -class CyclomaticComplexityMetric +class CyclomaticComplexityRule extends SolidLintRule { /// The [LintCode] of this lint rule that represents the error if complexity /// reaches maximum value. static const lintName = 'cyclomatic_complexity'; - CyclomaticComplexityMetric._(super.rule); + CyclomaticComplexityRule._(super.rule); - /// Creates a new instance of [CyclomaticComplexityMetric] + /// Creates a new instance of [CyclomaticComplexityRule] /// based on the lint configuration. - factory CyclomaticComplexityMetric.createRule(CustomLintConfigs configs) { + factory CyclomaticComplexityRule.createRule(CustomLintConfigs configs) { final rule = RuleConfig( configs: configs, name: lintName, @@ -42,7 +42,7 @@ class CyclomaticComplexityMetric '${value.maxComplexity}. Please decrease it.', ); - return CyclomaticComplexityMetric._(rule); + return CyclomaticComplexityRule._(rule); } @override diff --git a/lib/src/lints/cyclomatic_complexity/visitor/cyclomatic_complexity_flow_visitor.dart b/lib/src/lints/cyclomatic_complexity/visitors/cyclomatic_complexity_flow_visitor.dart similarity index 100% rename from lib/src/lints/cyclomatic_complexity/visitor/cyclomatic_complexity_flow_visitor.dart rename to lib/src/lints/cyclomatic_complexity/visitors/cyclomatic_complexity_flow_visitor.dart diff --git a/lib/src/lints/double_literal_format/double_literal_format_rule.dart b/lib/src/lints/double_literal_format/double_literal_format_rule.dart index 63ef4cba..d3e5bfb3 100644 --- a/lib/src/lints/double_literal_format/double_literal_format_rule.dart +++ b/lib/src/lints/double_literal_format/double_literal_format_rule.dart @@ -5,7 +5,7 @@ import 'package:custom_lint_builder/custom_lint_builder.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; -part 'double_literal_format_fix.dart'; +part 'fixes/double_literal_format_fix.dart'; part 'double_literal_format_utils.dart'; diff --git a/lib/src/lints/double_literal_format/double_literal_format_fix.dart b/lib/src/lints/double_literal_format/fixes/double_literal_format_fix.dart similarity index 97% rename from lib/src/lints/double_literal_format/double_literal_format_fix.dart rename to lib/src/lints/double_literal_format/fixes/double_literal_format_fix.dart index 23c3043a..2bc7e874 100644 --- a/lib/src/lints/double_literal_format/double_literal_format_fix.dart +++ b/lib/src/lints/double_literal_format/fixes/double_literal_format_fix.dart @@ -1,4 +1,4 @@ -part of 'double_literal_format_rule.dart'; +part of '../double_literal_format_rule.dart'; /// A Quick fix for `double_literal_format` rule /// Suggests the correct value for an issue diff --git a/lib/src/lints/function_lines_of_code/function_lines_of_code_metric.dart b/lib/src/lints/function_lines_of_code/function_lines_of_code_rule.dart similarity index 90% rename from lib/src/lints/function_lines_of_code/function_lines_of_code_metric.dart rename to lib/src/lints/function_lines_of_code/function_lines_of_code_rule.dart index 74387831..ff90076d 100644 --- a/lib/src/lints/function_lines_of_code/function_lines_of_code_metric.dart +++ b/lib/src/lints/function_lines_of_code/function_lines_of_code_rule.dart @@ -2,7 +2,7 @@ import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; import 'package:solid_lints/src/lints/function_lines_of_code/models/function_lines_of_code_parameters.dart'; -import 'package:solid_lints/src/lints/function_lines_of_code/visitor/function_lines_of_code_visitor.dart'; +import 'package:solid_lints/src/lints/function_lines_of_code/visitors/function_lines_of_code_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; @@ -19,17 +19,17 @@ import 'package:solid_lints/src/models/solid_lint_rule.dart'; /// excludeNames: /// - "Build" /// ``` -class FunctionLinesOfCodeMetric +class FunctionLinesOfCodeRule extends SolidLintRule { /// The [LintCode] of this lint rule that represents the error if number of /// parameters reaches the maximum value. static const lintName = 'function_lines_of_code'; - FunctionLinesOfCodeMetric._(super.config); + FunctionLinesOfCodeRule._(super.config); - /// Creates a new instance of [FunctionLinesOfCodeMetric] + /// Creates a new instance of [FunctionLinesOfCodeRule] /// based on the lint configuration. - factory FunctionLinesOfCodeMetric.createRule(CustomLintConfigs configs) { + factory FunctionLinesOfCodeRule.createRule(CustomLintConfigs configs) { final rule = RuleConfig( configs: configs, name: lintName, @@ -39,7 +39,7 @@ class FunctionLinesOfCodeMetric 'Try splitting this function into smaller parts.', ); - return FunctionLinesOfCodeMetric._(rule); + return FunctionLinesOfCodeRule._(rule); } @override diff --git a/lib/src/lints/function_lines_of_code/visitor/function_lines_of_code_visitor.dart b/lib/src/lints/function_lines_of_code/visitors/function_lines_of_code_visitor.dart similarity index 100% rename from lib/src/lints/function_lines_of_code/visitor/function_lines_of_code_visitor.dart rename to lib/src/lints/function_lines_of_code/visitors/function_lines_of_code_visitor.dart diff --git a/lib/src/lints/member_ordering/member_ordering_rule.dart b/lib/src/lints/member_ordering/member_ordering_rule.dart index 1cf3dede..5d30dd6b 100644 --- a/lib/src/lints/member_ordering/member_ordering_rule.dart +++ b/lib/src/lints/member_ordering/member_ordering_rule.dart @@ -1,6 +1,6 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/member_ordering/member_ordering_visitor.dart'; +import 'package:solid_lints/src/lints/member_ordering/visitors/member_ordering_visitor.dart'; import 'package:solid_lints/src/lints/member_ordering/models/member_ordering_parameters.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/member_ordering/member_ordering_visitor.dart b/lib/src/lints/member_ordering/visitors/member_ordering_visitor.dart similarity index 100% rename from lib/src/lints/member_ordering/member_ordering_visitor.dart rename to lib/src/lints/member_ordering/visitors/member_ordering_visitor.dart diff --git a/lib/src/lints/newline_before_return/newline_before_return_rule.dart b/lib/src/lints/newline_before_return/newline_before_return_rule.dart index d4ac5c80..dfd4c7ac 100644 --- a/lib/src/lints/newline_before_return/newline_before_return_rule.dart +++ b/lib/src/lints/newline_before_return/newline_before_return_rule.dart @@ -23,7 +23,7 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/newline_before_return/newline_before_return_visitor.dart'; +import 'package:solid_lints/src/lints/newline_before_return/visitors/newline_before_return_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/newline_before_return/newline_before_return_visitor.dart b/lib/src/lints/newline_before_return/visitors/newline_before_return_visitor.dart similarity index 100% rename from lib/src/lints/newline_before_return/newline_before_return_visitor.dart rename to lib/src/lints/newline_before_return/visitors/newline_before_return_visitor.dart diff --git a/lib/src/lints/no_empty_block/no_empty_block_rule.dart b/lib/src/lints/no_empty_block/no_empty_block_rule.dart index 6b713141..f083ea77 100644 --- a/lib/src/lints/no_empty_block/no_empty_block_rule.dart +++ b/lib/src/lints/no_empty_block/no_empty_block_rule.dart @@ -1,6 +1,6 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/no_empty_block/no_empty_block_visitor.dart'; +import 'package:solid_lints/src/lints/no_empty_block/visitors/no_empty_block_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/no_empty_block/no_empty_block_visitor.dart b/lib/src/lints/no_empty_block/visitors/no_empty_block_visitor.dart similarity index 100% rename from lib/src/lints/no_empty_block/no_empty_block_visitor.dart rename to lib/src/lints/no_empty_block/visitors/no_empty_block_visitor.dart diff --git a/lib/src/lints/no_equal_then_else/no_equal_then_else_rule.dart b/lib/src/lints/no_equal_then_else/no_equal_then_else_rule.dart index 400ca309..31989fec 100644 --- a/lib/src/lints/no_equal_then_else/no_equal_then_else_rule.dart +++ b/lib/src/lints/no_equal_then_else/no_equal_then_else_rule.dart @@ -1,6 +1,6 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/no_equal_then_else/no_equal_then_else_visitor.dart'; +import 'package:solid_lints/src/lints/no_equal_then_else/visitors/no_equal_then_else_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/no_equal_then_else/no_equal_then_else_visitor.dart b/lib/src/lints/no_equal_then_else/visitors/no_equal_then_else_visitor.dart similarity index 100% rename from lib/src/lints/no_equal_then_else/no_equal_then_else_visitor.dart rename to lib/src/lints/no_equal_then_else/visitors/no_equal_then_else_visitor.dart diff --git a/lib/src/lints/no_magic_number/no_magic_number_rule.dart b/lib/src/lints/no_magic_number/no_magic_number_rule.dart index 9c1a83c6..b1ba6091 100644 --- a/lib/src/lints/no_magic_number/no_magic_number_rule.dart +++ b/lib/src/lints/no_magic_number/no_magic_number_rule.dart @@ -27,7 +27,7 @@ import 'package:analyzer/error/listener.dart'; import 'package:collection/collection.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; import 'package:solid_lints/src/lints/no_magic_number/models/no_magic_number_parameters.dart'; -import 'package:solid_lints/src/lints/no_magic_number/no_magic_number_visitor.dart'; +import 'package:solid_lints/src/lints/no_magic_number/visitors/no_magic_number_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/no_magic_number/no_magic_number_visitor.dart b/lib/src/lints/no_magic_number/visitors/no_magic_number_visitor.dart similarity index 100% rename from lib/src/lints/no_magic_number/no_magic_number_visitor.dart rename to lib/src/lints/no_magic_number/visitors/no_magic_number_visitor.dart diff --git a/lib/src/lints/number_of_parameters/number_of_parameters_metric.dart b/lib/src/lints/number_of_parameters/number_of_parameters_rule.dart similarity index 89% rename from lib/src/lints/number_of_parameters/number_of_parameters_metric.dart rename to lib/src/lints/number_of_parameters/number_of_parameters_rule.dart index cd343a56..bacc4074 100644 --- a/lib/src/lints/number_of_parameters/number_of_parameters_metric.dart +++ b/lib/src/lints/number_of_parameters/number_of_parameters_rule.dart @@ -35,17 +35,17 @@ import 'package:solid_lints/src/models/solid_lint_rule.dart'; /// void method(a, b) {} // OK /// } /// ``` -class NumberOfParametersMetric +class NumberOfParametersRule extends SolidLintRule { /// The [LintCode] of this lint rule that represents the error if number of /// parameters reaches the maximum value. static const lintName = 'number_of_parameters'; - NumberOfParametersMetric._(super.rule); + NumberOfParametersRule._(super.rule); - /// Creates a new instance of [NumberOfParametersMetric] + /// Creates a new instance of [NumberOfParametersRule] /// based on the lint configuration. - factory NumberOfParametersMetric.createRule(CustomLintConfigs configs) { + factory NumberOfParametersRule.createRule(CustomLintConfigs configs) { final rule = RuleConfig( configs: configs, name: lintName, @@ -55,7 +55,7 @@ class NumberOfParametersMetric 'Try reducing the number of parameters.', ); - return NumberOfParametersMetric._(rule); + return NumberOfParametersRule._(rule); } @override diff --git a/lib/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_fix.dart b/lib/src/lints/prefer_conditional_expressions/fixes/prefer_conditional_expressions_fix.dart similarity index 98% rename from lib/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_fix.dart rename to lib/src/lints/prefer_conditional_expressions/fixes/prefer_conditional_expressions_fix.dart index f6da0115..4666bed8 100644 --- a/lib/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_fix.dart +++ b/lib/src/lints/prefer_conditional_expressions/fixes/prefer_conditional_expressions_fix.dart @@ -3,7 +3,7 @@ import 'package:analyzer/dart/ast/token.dart'; import 'package:analyzer/error/error.dart'; import 'package:analyzer/source/source_range.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_visitor.dart'; +import 'package:solid_lints/src/lints/prefer_conditional_expressions/visitors/prefer_conditional_expressions_visitor.dart'; /// A Quick fix for `prefer_conditional_expressions` rule /// Suggests to remove unnecessary assertions diff --git a/lib/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_rule.dart b/lib/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_rule.dart index a2af16e2..c2505e47 100644 --- a/lib/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_rule.dart +++ b/lib/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_rule.dart @@ -1,8 +1,8 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; import 'package:solid_lints/src/lints/prefer_conditional_expressions/models/prefer_conditional_expressions_parameters.dart'; -import 'package:solid_lints/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_fix.dart'; -import 'package:solid_lints/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_visitor.dart'; +import 'package:solid_lints/src/lints/prefer_conditional_expressions/fixes/prefer_conditional_expressions_fix.dart'; +import 'package:solid_lints/src/lints/prefer_conditional_expressions/visitors/prefer_conditional_expressions_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_visitor.dart b/lib/src/lints/prefer_conditional_expressions/visitors/prefer_conditional_expressions_visitor.dart similarity index 100% rename from lib/src/lints/prefer_conditional_expressions/prefer_conditional_expressions_visitor.dart rename to lib/src/lints/prefer_conditional_expressions/visitors/prefer_conditional_expressions_visitor.dart diff --git a/lib/src/lints/prefer_first/prefer_first_fix.dart b/lib/src/lints/prefer_first/fixes/prefer_first_fix.dart similarity index 100% rename from lib/src/lints/prefer_first/prefer_first_fix.dart rename to lib/src/lints/prefer_first/fixes/prefer_first_fix.dart diff --git a/lib/src/lints/prefer_first/prefer_first_rule.dart b/lib/src/lints/prefer_first/prefer_first_rule.dart index 285828f2..5a584be4 100644 --- a/lib/src/lints/prefer_first/prefer_first_rule.dart +++ b/lib/src/lints/prefer_first/prefer_first_rule.dart @@ -1,7 +1,7 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/prefer_first/prefer_first_fix.dart'; -import 'package:solid_lints/src/lints/prefer_first/prefer_first_visitor.dart'; +import 'package:solid_lints/src/lints/prefer_first/fixes/prefer_first_fix.dart'; +import 'package:solid_lints/src/lints/prefer_first/visitors/prefer_first_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/prefer_first/prefer_first_visitor.dart b/lib/src/lints/prefer_first/visitors/prefer_first_visitor.dart similarity index 100% rename from lib/src/lints/prefer_first/prefer_first_visitor.dart rename to lib/src/lints/prefer_first/visitors/prefer_first_visitor.dart diff --git a/lib/src/lints/prefer_last/prefer_last_fix.dart b/lib/src/lints/prefer_last/fixes/prefer_last_fix.dart similarity index 100% rename from lib/src/lints/prefer_last/prefer_last_fix.dart rename to lib/src/lints/prefer_last/fixes/prefer_last_fix.dart diff --git a/lib/src/lints/prefer_last/prefer_last_rule.dart b/lib/src/lints/prefer_last/prefer_last_rule.dart index 14a27475..dae3193a 100644 --- a/lib/src/lints/prefer_last/prefer_last_rule.dart +++ b/lib/src/lints/prefer_last/prefer_last_rule.dart @@ -1,7 +1,7 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; -import 'package:solid_lints/src/lints/prefer_last/prefer_last_fix.dart'; -import 'package:solid_lints/src/lints/prefer_last/prefer_last_visitor.dart'; +import 'package:solid_lints/src/lints/prefer_last/fixes/prefer_last_fix.dart'; +import 'package:solid_lints/src/lints/prefer_last/visitors/prefer_last_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; diff --git a/lib/src/lints/prefer_last/prefer_last_visitor.dart b/lib/src/lints/prefer_last/visitors/prefer_last_visitor.dart similarity index 100% rename from lib/src/lints/prefer_last/prefer_last_visitor.dart rename to lib/src/lints/prefer_last/visitors/prefer_last_visitor.dart diff --git a/lib/src/lints/prefer_match_file_name/prefer_match_file_name_rule.dart b/lib/src/lints/prefer_match_file_name/prefer_match_file_name_rule.dart index 1fe9bea9..4d2d9b72 100644 --- a/lib/src/lints/prefer_match_file_name/prefer_match_file_name_rule.dart +++ b/lib/src/lints/prefer_match_file_name/prefer_match_file_name_rule.dart @@ -1,7 +1,7 @@ import 'package:analyzer/error/listener.dart'; import 'package:custom_lint_builder/custom_lint_builder.dart'; import 'package:path/path.dart' as p; -import 'package:solid_lints/src/lints/prefer_match_file_name/prefer_match_file_name_visitor.dart'; +import 'package:solid_lints/src/lints/prefer_match_file_name/visitors/prefer_match_file_name_visitor.dart'; import 'package:solid_lints/src/models/rule_config.dart'; import 'package:solid_lints/src/models/solid_lint_rule.dart'; import 'package:solid_lints/src/utils/node_utils.dart'; diff --git a/lib/src/lints/prefer_match_file_name/prefer_match_file_name_visitor.dart b/lib/src/lints/prefer_match_file_name/visitors/prefer_match_file_name_visitor.dart similarity index 100% rename from lib/src/lints/prefer_match_file_name/prefer_match_file_name_visitor.dart rename to lib/src/lints/prefer_match_file_name/visitors/prefer_match_file_name_visitor.dart