Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update unavailable_function rule to also detect preconditionFailure() and abort() #3374

Closed
2 tasks done
quinntaylor opened this issue Oct 7, 2020 · 2 comments
Closed
2 tasks done

Comments

@quinntaylor
Copy link
Contributor

New Issue Checklist

Describe the bug

The unavailable_function rule warns when a function contains fatalError() with no other return branches, but does not detect preconditionFailure() or abort() calls, which also terminate execution.

Although Xcode fix-its often suggest fatalError(), some developers find it preferable to use preconditionFailure() instead.

https://lapcatsoftware.com/articles/fatalError.html

Environment

  • SwiftLint version: 0.38.2
  • Installation method used: macOS installer package
  • Paste your configuration file:
opt_in_rules:
    - unavailable_function
  • Are you using nested configurations? No
  • Which Xcode version are you using? 12.0
  • Do you have a sample that shows the issue? Yes
// This does NOT trigger a violation, but should:
class ViewController: UIViewController {
    public required init?(coder aDecoder: NSCoder) {
        preconditionFailure("init(coder:) has not been implemented")
    }
}
quinntaylor added a commit to quinntaylor/SwiftLint that referenced this issue Oct 7, 2020
@quinntaylor
Copy link
Contributor Author

quinntaylor commented Oct 7, 2020

PR: #3375

@quinntaylor
Copy link
Contributor Author

@jpsim / @marcelofabri, is it possible to get some eyes on this issue and PR? Thanks!

quinntaylor added a commit to quinntaylor/SwiftLint that referenced this issue Nov 4, 2020
jpsim pushed a commit to quinntaylor/SwiftLint that referenced this issue Nov 7, 2020
@jpsim jpsim closed this as completed Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants