Local variable declared but never read

ID

objectivec.maintainability.unused_local_variable

Severity

info

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Dead Code

Language

Objective-C

Description

This local is assigned and never read afterwards. Remove it, or use the value if the read was the point.

Rationale

This local is assigned and never read afterwards. Remove it, or use the value if the read was the point.

The following code illustrates the pattern detected by this rule:

@implementation Locals
// FLAGGED: Local variable declared but never read
- (void)withUnused {
    NSInteger forgotten = 5;
    NSLog(@"nothing to do with it");
}
@end

Remediation

Follow secure coding practices and review the references below for detailed remediation guidance.

Configuration

This detector does not need any configuration.

© 2026 Xygeni. All rights reserved