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

[CM-995] Add new linter rules and fix warnings #35

Merged
merged 1 commit into from
Dec 13, 2022

Conversation

mpospese
Copy link
Contributor

@mpospese mpospese commented Dec 12, 2022

Introduction

Our style guide requires the use of implicit return and our library team requires full documentation, so we should add linter rules to enforce these things instead of having to spot them during code review.

Purpose

Update SwiftLint config with implicit_return and missing_docs rules. Fix any linter violations.

Scope

  • Update .swiftlint.yml
  • Fix linter violations

Discussion

YCoreUI had some violations of the implicit_return rule.

The other changes come from changes to a recent version of SwiftLint (0.50.1) which altered the behavior of the body_length, and file_length rules. There’s also a new change in how SwiftLint enforces the large_tuple rule. I just disabled it for the unit tests in question. (Not worth declaring specialty struct’s in this case in my opinion.) There’s also one use in the source code in the UIColor extension that parses out the rgba channel values. I didn’t want to change that and a struct seemed super heavy compared to a tuple of 4 float values.

I also deleted some unused colors that were being declared for unit tests (one of the deleted color triggered the missing_docs rule because it had been declared as public).

We want to roll out these changes to all of our YML libraries, both in Bitbucket and on GitHub.

Fixes Issue #33

📈 Coverage

Unchanged. And documentation coverage should now be enforced by the linter!

@mpospese mpospese merged commit 67ec08e into main Dec 13, 2022
@mpospese mpospese deleted the improvement/CM-995-add-linter-rules branch December 13, 2022 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add implicit_return and missing_docs rules to SwiftLint
2 participants