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

DiscouragedDirectInitRule should apply to NSError #4507

Closed
2 tasks done
jszumski opened this issue Nov 3, 2022 · 0 comments · Fixed by #4508
Closed
2 tasks done

DiscouragedDirectInitRule should apply to NSError #4507

jszumski opened this issue Nov 3, 2022 · 0 comments · Fixed by #4508

Comments

@jszumski
Copy link
Contributor

jszumski commented Nov 3, 2022

New Issue Checklist

Describe the bug

DiscouragedDirectInitRule should apply to NSError(). Directly initializing NSError results in a runtime warning:

-[NSError init] called; this results in an invalid NSError instance. It will raise an exception in a future release. Please call errorWithDomain:code:userInfo: or initWithDomain:code:userInfo:. This message shown only once.

Complete output when running SwiftLint, including the stack trace and command used

n/a

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.49.1

  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew

  • Paste your configuration file: uses defaults

  • Are you using nested configurations?
    If so, paste their relative paths and respective contents. no

  • Which Xcode version are you using (check xcodebuild -version)? Xcode 14.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.

let foo = NSError()
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

Successfully merging a pull request may close this issue.

1 participant