As the name suggests, SwiftLint is a tool used by the Swift community to enforce certain rules, styles, and conventions.

Although I use SwiftLint in my own projects, its real value shows when used in a shared codebase. Code reviews, for instance, are expensive, requiring a lot of back-and-forth between the engineer who submitted the code for review and the reviewers. Quite frequently the suggestions from reviewers are related to coding style and conventions, wasting everyone’s time.

Team opinion should be automated whenever it’s possible, reducing the time wasted in code reviews, leaving the practice for what really matter: logic, performance, code design and architecture.

I first looked into SwiftLint when I caught myself repeating the same feedback in different pull requests. Most of the rules needed by the team were part of SwiftLint already, but some conventions we had were missing. That’s when I decided to contribute to the project, resulting in several new rules and improvements.

Some of the rules I added to the project include:

If I had to pick a favorite rule from the list above, it would be the Multiline Parameter. This was the first rule I implemented and one of the first I enable in a new project.