Skip to content

Commit

Permalink
better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
sufftea committed May 2, 2024
1 parent 25c1c77 commit 1c321db
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class AvoidReturningWidgetsRule extends SolidLintRule<IgnoredEntitiesModel> {

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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AvoidUnusedParametersVisitor extends RecursiveAstVisitor<void> {
return;
}

if (ignoredEntities.matchClass(node)) {
if (ignoredEntities.isIgnoredClass(node)) {
return;
}

Expand Down Expand Up @@ -85,7 +85,8 @@ class AvoidUnusedParametersVisitor extends RecursiveAstVisitor<void> {
return;
}

if (ignoredEntities.matchMethod(node) || ignoredEntities.matchClass(node)) {
if (ignoredEntities.isIgnoredMethod(node) ||
ignoredEntities.isIgnoredClass(node)) {
return;
}

Expand All @@ -109,7 +110,7 @@ class AvoidUnusedParametersVisitor extends RecursiveAstVisitor<void> {
return;
}

if (ignoredEntities.matchMethod(node)) {
if (ignoredEntities.isIgnoredMethod(node)) {
return;
}

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class NoEmptyBlockVisitor extends RecursiveAstVisitor<void> {
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;
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ClassDeclaration>();
if (classNode == null) {
return false;
Expand All @@ -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<Declaration>();
if (methodNode == null) {
return false;
Expand Down

0 comments on commit 1c321db

Please sign in to comment.