Skip to content

Commit

Permalink
Refactor package structure
Browse files Browse the repository at this point in the history
  • Loading branch information
sufftea committed Apr 29, 2024
1 parent 4fd6557 commit 6813939
Show file tree
Hide file tree
Showing 43 changed files with 49 additions and 49 deletions.
12 changes: 6 additions & 6 deletions lib/solid_lints.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -38,9 +38,9 @@ class _SolidLints extends PluginBase {
@override
List<LintRule> getLintRules(CustomLintConfigs configs) {
final List<SolidLintRule> 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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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<CyclomaticComplexityParameters> {
/// 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,
Expand All @@ -42,7 +42,7 @@ class CyclomaticComplexityMetric
'${value.maxComplexity}. Please decrease it.',
);

return CyclomaticComplexityMetric._(rule);
return CyclomaticComplexityRule._(rule);
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -19,17 +19,17 @@ import 'package:solid_lints/src/models/solid_lint_rule.dart';
/// excludeNames:
/// - "Build"
/// ```
class FunctionLinesOfCodeMetric
class FunctionLinesOfCodeRule
extends SolidLintRule<FunctionLinesOfCodeParameters> {
/// 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,
Expand All @@ -39,7 +39,7 @@ class FunctionLinesOfCodeMetric
'Try splitting this function into smaller parts.',
);

return FunctionLinesOfCodeMetric._(rule);
return FunctionLinesOfCodeRule._(rule);
}

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/src/lints/member_ordering/member_ordering_rule.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion lib/src/lints/no_empty_block/no_empty_block_rule.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion lib/src/lints/no_magic_number/no_magic_number_rule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<NumberOfParametersParameters> {
/// 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,
Expand All @@ -55,7 +55,7 @@ class NumberOfParametersMetric
'Try reducing the number of parameters.',
);

return NumberOfParametersMetric._(rule);
return NumberOfParametersRule._(rule);
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
4 changes: 2 additions & 2 deletions lib/src/lints/prefer_first/prefer_first_rule.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
4 changes: 2 additions & 2 deletions lib/src/lints/prefer_last/prefer_last_rule.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit 6813939

Please sign in to comment.