From 1c321dbc85c7276072e6cce24e7abed265f8c412 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 2 May 2024 19:06:09 +0300 Subject: [PATCH] better naming --- .../avoid_returning_widgets_rule.dart | 4 ++-- .../visitors/avoid_unused_parameters_visitor.dart | 7 ++++--- .../cyclomatic_complexity/cyclomatic_complexity_rule.dart | 4 ++-- .../function_lines_of_code_rule.dart | 4 ++-- .../no_empty_block/visitors/no_empty_block_visitor.dart | 4 ++-- .../number_of_parameters/number_of_parameters_rule.dart | 4 ++-- .../ignored_entities_model/ignored_entities_model.dart | 4 ++-- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/src/lints/avoid_returning_widgets/avoid_returning_widgets_rule.dart b/lib/src/lints/avoid_returning_widgets/avoid_returning_widgets_rule.dart index 9f0a54a..09ddbb6 100644 --- a/lib/src/lints/avoid_returning_widgets/avoid_returning_widgets_rule.dart +++ b/lib/src/lints/avoid_returning_widgets/avoid_returning_widgets_rule.dart @@ -94,8 +94,8 @@ class AvoidReturningWidgetsRule extends SolidLintRule { final isWidgetReturned = hasWidgetType(returnType); - final isIgnored = config.parameters.matchMethod(node) || - config.parameters.matchClass(node); + final isIgnored = config.parameters.isIgnoredMethod(node) || + config.parameters.isIgnoredClass(node); final isOverriden = node.declaredElement?.hasOverride ?? false; diff --git a/lib/src/lints/avoid_unused_parameters/visitors/avoid_unused_parameters_visitor.dart b/lib/src/lints/avoid_unused_parameters/visitors/avoid_unused_parameters_visitor.dart index fe79224..335972e 100644 --- a/lib/src/lints/avoid_unused_parameters/visitors/avoid_unused_parameters_visitor.dart +++ b/lib/src/lints/avoid_unused_parameters/visitors/avoid_unused_parameters_visitor.dart @@ -56,7 +56,7 @@ class AvoidUnusedParametersVisitor extends RecursiveAstVisitor { return; } - if (ignoredEntities.matchClass(node)) { + if (ignoredEntities.isIgnoredClass(node)) { return; } @@ -85,7 +85,8 @@ class AvoidUnusedParametersVisitor extends RecursiveAstVisitor { return; } - if (ignoredEntities.matchMethod(node) || ignoredEntities.matchClass(node)) { + if (ignoredEntities.isIgnoredMethod(node) || + ignoredEntities.isIgnoredClass(node)) { return; } @@ -109,7 +110,7 @@ class AvoidUnusedParametersVisitor extends RecursiveAstVisitor { return; } - if (ignoredEntities.matchMethod(node)) { + if (ignoredEntities.isIgnoredMethod(node)) { return; } diff --git a/lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_rule.dart b/lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_rule.dart index 1522ba6..7b0feb0 100644 --- a/lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_rule.dart +++ b/lib/src/lints/cyclomatic_complexity/cyclomatic_complexity_rule.dart @@ -52,8 +52,8 @@ class CyclomaticComplexityRule CustomLintContext context, ) { context.registry.addBlockFunctionBody((node) { - if (config.parameters.ignoredEntities.matchMethod(node) || - config.parameters.ignoredEntities.matchClass(node)) { + if (config.parameters.ignoredEntities.isIgnoredMethod(node) || + config.parameters.ignoredEntities.isIgnoredClass(node)) { return; } diff --git a/lib/src/lints/function_lines_of_code/function_lines_of_code_rule.dart b/lib/src/lints/function_lines_of_code/function_lines_of_code_rule.dart index a2abc8f..facc475 100644 --- a/lib/src/lints/function_lines_of_code/function_lines_of_code_rule.dart +++ b/lib/src/lints/function_lines_of_code/function_lines_of_code_rule.dart @@ -63,8 +63,8 @@ class FunctionLinesOfCodeRule ErrorReporter reporter, AstNode node, ) { - if (config.parameters.ignoredEntitiesModel.matchMethod(node) || - config.parameters.ignoredEntitiesModel.matchClass(node)) { + if (config.parameters.ignoredEntitiesModel.isIgnoredMethod(node) || + config.parameters.ignoredEntitiesModel.isIgnoredClass(node)) { return; } diff --git a/lib/src/lints/no_empty_block/visitors/no_empty_block_visitor.dart b/lib/src/lints/no_empty_block/visitors/no_empty_block_visitor.dart index fe497a0..d1cdc13 100644 --- a/lib/src/lints/no_empty_block/visitors/no_empty_block_visitor.dart +++ b/lib/src/lints/no_empty_block/visitors/no_empty_block_visitor.dart @@ -48,8 +48,8 @@ class NoEmptyBlockVisitor extends RecursiveAstVisitor { if (node.statements.isNotEmpty) return; if (node.parent is CatchClause) return; if (_isPrecedingCommentToDo(node)) return; - if (ignoredEntitiesModel.matchClass(node) || - ignoredEntitiesModel.matchMethod(node)) { + if (ignoredEntitiesModel.isIgnoredClass(node) || + ignoredEntitiesModel.isIgnoredMethod(node)) { return; } diff --git a/lib/src/lints/number_of_parameters/number_of_parameters_rule.dart b/lib/src/lints/number_of_parameters/number_of_parameters_rule.dart index 3d5652a..1d31827 100644 --- a/lib/src/lints/number_of_parameters/number_of_parameters_rule.dart +++ b/lib/src/lints/number_of_parameters/number_of_parameters_rule.dart @@ -65,8 +65,8 @@ class NumberOfParametersRule CustomLintContext context, ) { context.registry.addDeclaration((node) { - if (config.parameters.ignoredEntitiesModel.matchClass(node) || - config.parameters.ignoredEntitiesModel.matchMethod(node)) { + if (config.parameters.ignoredEntitiesModel.isIgnoredClass(node) || + config.parameters.ignoredEntitiesModel.isIgnoredMethod(node)) { return; } diff --git a/lib/src/models/ignored_entities_model/ignored_entities_model.dart b/lib/src/models/ignored_entities_model/ignored_entities_model.dart index 0ea8971..baebafe 100644 --- a/lib/src/models/ignored_entities_model/ignored_entities_model.dart +++ b/lib/src/models/ignored_entities_model/ignored_entities_model.dart @@ -39,7 +39,7 @@ class IgnoredEntitiesModel { /// Checks if the entire class should be ignored. /// Doesn't match if the config specifies a specific function within the class - bool matchClass(AstNode node) { + bool isIgnoredClass(AstNode node) { final classNode = node.thisOrAncestorOfType(); if (classNode == null) { return false; @@ -53,7 +53,7 @@ class IgnoredEntitiesModel { } /// Checks if the given method/function should be ignored. - bool matchMethod(AstNode node) { + bool isIgnoredMethod(AstNode node) { final methodNode = node.thisOrAncestorOfType(); if (methodNode == null) { return false;