Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

prohibited_super_call rule false violation with NSFileProviderExtension providePlaceholder override #2212

Closed
2 tasks done
BenStaveleyTaylor opened this issue May 18, 2018 · 0 comments
Labels
bug Unexpected and reproducible misbehavior.

Comments

@BenStaveleyTaylor
Copy link
Contributor

New Issue Checklist

Bug Report

The prohibited_super_call rule generates an incorrect violation report when linting the providePlaceholder override for an NSFileProviderExtension implementation. The code to repro shown below is taken directly from the Apple template code generated for a new FileProvider extension target and does not call super.

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint --config swiftlint.yml 
Loading configuration from 'swiftlint.yml'
Linting Swift files in current working directory
Linting 'FileProviderExtension.swift' (1/1)
/Users/bestave/Desktop/DeleteMe/DeleteMeFP/ProhibitedSuperTest/FileProviderExtension.swift:5:99: warning: Prohibited calls to super Violation: Method 'providePlaceholder(at:completionHandler:)' should not call to super function (prohibited_super_call)
Done linting! Found 1 violation, 0 serious in 1 file.

Environment

  • SwiftLint version: 0.25.1 (release and latest source)
  • Installation method used: SwiftLint.pkg installer and also cloned/built from master source
  • Paste your configuration file:
opt_in_rules:
  - prohibited_super_call
  • Are you using [nested configurations]? No
  • Which Xcode version are you using? 9.3.1
  • Do you have a sample that shows the issue? Yes:
import FileProvider

public class FileProviderExtension: NSFileProviderExtension {

    override func providePlaceholder(at url: URL, completionHandler: @escaping (Error?) -> Void) {
        guard let identifier = persistentIdentifierForItem(at: url) else {
            completionHandler(NSFileProviderError(.noSuchItem))
            return
        }
    }

}
@marcelofabri marcelofabri added the bug Unexpected and reproducible misbehavior. label May 18, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

No branches or pull requests

2 participants