Avoid equality operators in loop termination conditions
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.
error-handlingreadability-refactor
Critical
Avoid Returning Null in Non-Async Task Methods
Returning null from a Task or Task<T> method causes a NullReferenceException if awaited. Use Task.CompletedTask or Task.FromResult<T>(null) instead.
error-handlingreadability-refactor+1
Critical
Avoid Using Boolean Expressions in `except` Statements
Detect `except` clauses that use `or` or `and` to catch multiple exceptions. This does not work as intended. Recommend using a tuple of exceptions instead.
error-handlingstack-python
Critical
Don’t Create Exceptions Without Raising Them
Identify instances where an exception object is created but never raised. This is likely an oversight and should either be removed or properly raised.
error-handlingstack-python
Critical
Don’t Use `assert` for Data Validation
Ensure that `assert` is not used for validating user input or critical checks. Assertions can be disabled in optimized mode (`python -O`). Recommend using explicit validation with `if` conditions and raising proper exceptions.
error-handlingstack-python
Critical
Ensure `case` Statements Have an `else` Clause
Check if every `case` statement includes an `else` clause. If an `else` clause is missing, ensure that a comment explicitly states why it is unnecessary.
error-handlingreadability-refactor
Critical
Ensure `if...elsif` Constructs End with an `else` Clause
Verify that all `if...elsif` constructs include a final `else` clause. If `else` is missing, ensure there is a comment explaining why all cases are covered.
error-handlingreadability-refactor
Critical
Only Catch Exceptions That Derive from `BaseException`
Detect exception handling blocks that catch objects not derived from `BaseException`. This causes a `TypeError` and should be avoided.
error-handlingstack-python
Critical
Re-raise `SystemExit` and `KeyboardInterrupt`
Ensure that `SystemExit` and `KeyboardInterrupt` are not caught without being re-raised. Preventing Python from exiting can cause unintended behavior.
error-handlingstack-python
High
"this" should not be used in functional components
Ensure that 'this' is not used in functional components. Functional components do not have a 'this' context. Use props and destructuring for data access instead.
error-handlingstack-react
High
Add comprehensive error logging
Log failures with operation name, key identifiers, and exception; prefer structured logging (fields).
error-handlingobservability-logging
High
Add comprehensive input validation
Validate required parameters at boundaries using require/requireNotNull or explicit validators; fail fast with actionable messages.
error-handlingsecurity-hardening
High
Add comprehensive null checks for parameters
Validate method inputs up front with null checks or use Objects.requireNonNull and meaningful messages.
error-handlingsecurity-hardening
High
Add error handling for API response access
Validate HTTP status and safely access nested response data using `dig`/guards.
api-conventionserror-handling
High
Add error handling for external service calls
Wrap HTTP/SDK calls with timeouts and catch transport/errors; log context and map to domain failures.
error-handlingobservability-logging+2
High
Add error handling for file operations
Wrap file reads/writes (e.g., file_get_contents, file_put_contents, fopen) with checks and exceptions; never assume the filesystem is available.
error-handlingstack-php
High
Add error handling for JSON marshalling
Always check and handle errors from json.Marshal/json.Unmarshal (or Encoder/Decoder). Log context and return a safe, consistent error to callers.
error-handling
High
Add error handling to app initialization
Guard app startup with zone-level handlers and FlutterError hooks; surface fatal errors and report them.
error-handlingobservability-logging+1
High
Add explicit environment variable checks
Validate required runtime env vars at container start via an entrypoint script; exit with a clear message on missing values.
config-environmentcontainer-docker-hygiene+1
High
Add input validation for critical parameters
Validate presence, type, and range of critical inputs at boundaries (API, CLI, jobs) and fail fast with clear messages.
api-conventionserror-handling+2
High
Add null checks before accessing properties
When accessing properties that may be absent, use optional chaining and sensible defaults.
error-handling
High
Add null checks to prevent NullReferenceException
Guard all potentially-null references with null checks, null-coalescing, or pattern matching before dereferencing.
error-handling
High
Add specific exception handling
Catch and handle only the exceptions you expect (e.g., KeyError, ValueError, TimeoutError); let unknown ones bubble.
error-handlingstack-python
High
Add transaction handling with rollback
Wrap multi-statement DB operations in a transaction; commit on success and rollback on any exception.