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

Lint for implicitly unwrapped optionals #453

Open
1ec5 opened this issue Sep 2, 2020 · 1 comment
Open

Lint for implicitly unwrapped optionals #453

1ec5 opened this issue Sep 2, 2020 · 1 comment
Labels

Comments

@1ec5
Copy link
Contributor

1ec5 commented Sep 2, 2020

To prevent regressions of #228 like #447, we should install SwiftLint and configure it to warn on force_unwrapping in the four framework targets, then install Danger to surface the warning. Other linting rules and the example and test bundle targets are out of scope.

I think warning on force_unwrapping is a reasonable step in this repository specifically, because this project primarily encodes and decodes data and requests and receives HTTP responses. This library is designed to give the developer as much control as possible, including control over error handling, so a force-unwrap is almost never appropriate.

/cc @mapbox/navigation-ios @dmiluski

@1ec5 1ec5 added the build label Sep 2, 2020
@dmiluski
Copy link

dmiluski commented Sep 2, 2020

Agreed.

Force unwrapping is almost never necessary. Or can be avoided with optional chaining/guard/defaults.

Exception:
When creating base URLs which swiftlint offers a special exception for, which can include an exception yet still verify with a quick test in CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants