detekt vs SwiftLint
detekt
detekt.devSwiftLint
realm.github.ioSide by side
| Figure | detekt | SwiftLint |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | — | — |
| Windows | Yes | Yes |
| macOS | Yes | Yes |
| Linux | Yes | Yes |
| Plans published | 1 | 1 |
| Spec score · Linters | 7.8 (#16) | 8.0 (#11) |
| Purpose | detekt is a static code analyzer for Kotlin that helps identify code smells. | SwiftLint enforces Swift style and conventions based on rules generally accepted by the Swift community. |
Plans
In their own words
detekt
detekt is a free static code analyzer for Kotlin that helps identify code smells. It supports Android, JVM, JS, Native, and Multiplatform projects, and runs on Linux, macOS, and Windows. Developers can configure rule sets, create baselines for existing issues, and suppress findings with @Suppress annotations. Reports can be generated as HTML, Markdown, SARIF, Checkstyle XML, or custom formats; complexity reports can include lines of code, cyclomatic complexity, and code smell counts. The project provides a Gradle plugin and documents use with Gradle, Maven, and Bazel builds. Its Gradle plugin requires Gradle 6.8.3 or higher. Custom rule sets can be added through detekt's RuleSetProvider and ServiceLoader pattern, and the marketplace lists community rules, extensions, and plugins. CLI installation guidance covers Homebrew on macOS, Scoop on Windows, SDKMAN on Unix-like systems, and NixOS. detekt supports autofix, IDE use, and CI. Its security policy says patches are applied up to the current minor version, with earlier versions handled case by case.
SwiftLint
SwiftLint is a free, MIT-licensed tool that checks Swift source against style rules and conventions accepted by the Swift community. It includes more than 200 built-in rules, with opt-in rules disabled by default. A project can set active rules, included and excluded paths, and rule settings in a `.swiftlint.yml` file. SwiftLint can automatically correct some violations, overwriting affected files, and its command line supports linting, analysis, baselines, rule listings, and multiple reporters. Documented integrations include Xcode and Swift Package Manager plugins, pre-commit, Fastlane, Docker, Visual Studio Code, and MegaLinter. Installation choices include package managers, prebuilt packages, and source builds. Releases include macOS, Windows, and Linux binaries. SwiftLint is intended for valid, compilable source, and non-compiling code may produce unexpected results, especially when autocorrecting. Analyzer rules are considerably slower than lint rules. The project is maintained by volunteers, and the maintainers describe it as non-commercial.