realm / realm/SwiftLint

The `overridden_super_call` rule does not detect missing super call in `updateTrackingAreas()`

Open
#2,616 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

New Issue Checklist
Describe the bug

The rule does not detect that the following is missing a super call:

class Button: NSButton {
	override func updateTrackingAreas() {
		// …
	}
}

It should be:

class Button: NSButton {
	override func updateTrackingAreas() {
		super.updateTrackingAreas()
	}
}

From Apple docs:

You should override this method to remove out of date tracking areas and add recomputed tracking areas; your implementation should call super.
- https://developer.apple.com/documentation/appkit/nsview/1483719-updatetrackingareas#

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Environment
  • SwiftLint version (run swiftlint version to be sure)? 0.30.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Installer from GitHub
  • Paste your configuration file:
opt_in_rules:
  - overridden_super_call
  • Are you using nested configurations? No
  • Which Xcode version are you using (check xcode-select -p)? 10.1
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
echo "class Button: NSButton { override func updateTrackingAreas() {} }" | swiftlint lint --no-cache --use-stdin --enable-all-rules

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the overridden_super_call rule and reproduce the report with the provided SwiftLint stdin command using updateTrackingAreas(). Trace how required super calls are identified, then verify that an override without super.updateTrackingAreas() is reported while the corrected example is accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.