Refinement of unneeded_override
Rule to Properly Handle Swift Attributes
#5753
Labels
bug
Unexpected and reproducible misbehavior.
good first issue
Issue to be taken up by new contributors yet unfamiliar with the project.
New Issue Checklist
Feature or Enhancement Proposal
The
unneeded_override
rule in SwiftLint currently triggers a warning for methods that are overridden solely to add Swift attributes, such as@objc
,@IBAction
, and similar. Consider the following example:In this case, SwiftLint issues a warning on the overridden foo() method, indicating that the override is unnecessary. However, the override is intentionally used to apply a specific attribute, which is a legitimate use case.
This raises a discussion point: while attributes on overridden methods may be necessary, the current rule does not appropriately account for this scenario. The rule should be refined to differentiate between purely redundant overrides and those that serve the purpose of attribute application.
Environment
The text was updated successfully, but these errors were encountered: