Store repeated string literals in constants or variables to improve maintainability and reduce redundancy.
duplication-complexitymaintainability
Critical
Avoid Redundant `None` Comparisons
Identify cases where `x is None` or `x is not None` is used redundantly when `x` is always or never `None`. This may indicate a deeper logic issue.
duplication-complexityreadability-refactor+1
High
Avoid Functions That Always Return the Same Value
Identify functions that return the same value regardless of input. This may indicate poor design or a logic error.
duplication-complexityreadability-refactor+1
High
Avoid Unnecessary `toList()` with Spread Operator
Remove unnecessary calls to `.toList()` when using the spread operator (`...`) as it is already designed to work with iterable collections.
duplication-complexityperformance-efficiency+1
High
Avoid Unnecessary `toList()` with Spread Operator
Remove unnecessary `.toList()` calls when using the spread operator (`...`) to avoid redundant operations.
duplication-complexityperformance-efficiency+1
High
Consolidate duplicated permission checking logic
Provide a single permission check API (e.g., can(user, action, resource)) and reuse it across layers.
duplication-complexitymodule-architecture+1
High
Ensure Getters and Setters Access the Correct Fields
Copy-pasting code can lead to errors where getters or setters access the wrong fields. Always verify that properties interact with the expected fields.
duplication-complexitymaintainability
High
Forbid cross-package relative imports in JS/TS
In JS/TS workspaces, imports must use workspace package names (as defined in each package.json and exports) rather than relative paths crossing package boundaries.
monorepo-hygienemodule-architecture+1
High
Limit Lengthy LINQ Chains
Verify that LINQ queries are not excessively long. Break complex queries into smaller, more understandable expressions.
duplication-complexityreadability-refactor
High
Prefer Guard Clauses Over Nested Conditionals
Detect deeply nested conditionals and suggest using guard clauses (`return unless condition`) instead to improve readability.
duplication-complexityreadability-refactor
Low
Avoid Brain Methods (Methods Doing Too Many Tasks)
Ensure that methods perform a single, well-defined task. Large methods should be refactored into smaller, focused methods.
duplication-complexityreadability-refactor
Low
AVOID redundancy with the surrounding context
Check if the method, variable, or class title contains redundant context (e.g., using 'carDrive()' when 'drive()' would suffice). Ensure the title is concise and avoids repetition of surrounding context.
duplication-complexityreadability-refactor+2
Low
Avoid Redundant Null Checks with `instanceof`
Ensure that explicit null checks are not used with `instanceof`, as `null` is never an instance of any class.
duplication-complexity
Low
Avoid Unnecessary Defensive Programming
Identify overly defensive code that checks for unrealistic conditions, such as excessive `nil?` checks or redundant type verifications.
duplication-complexityreadability-refactor
Low
Centralize analytics tracking logic
Route all analytics events through a single service/helper instead of calling the SDK directly from widgets and blocs.
duplication-complexitymaintainability+2
Low
Centralize key generation logic
Generate cache/Redis keys through a single utility with clear namespaces and versioning.
caching-strategyduplication-complexity+1
Low
Centralize string constants
Define shared string literals (route names, keys, claim types) as constants/enums in a single place.
duplication-complexitymaintainability+1
Low
Combine Multiple Loops Over the Same Collection
Ensure that multiple loops over the same collection are combined into a single loop to improve efficiency.
duplication-complexityperformance-efficiency
Low
Consolidate duplicate Dockerfiles
Deduplicate near-identical Dockerfiles by sharing a common base stage (multi-stage) and varying only service-specific steps via build args/targets.
container-docker-hygieneduplication-complexity
Low
Consolidate duplicated query logic
Extract reusable SQL fragments/builders for commonly repeated WHERE/ORDER clauses.