About this project

SwiftLint is a popular open-source tool for enforcing Swift code style and conventions, loosely based on the now-archived GitHub Swift Style Guide. It enforces rules generally accepted by the Swift community, as described in popular style guides such as Kodeco's Swift Style Guide. The tool includes over 200 rules, predominantly based on SwiftSyntax, with some rules hooking into Clang and SourceKit for type information. Rules can be configured via a .swiftlint.yml file, and individual rules can be disabled inline using comments (e.g., // swiftlint:disable rule_name). Opt-in rules are disabled by default and must be explicitly enabled. SwiftLint supports multiple installation methods: Swift Package Manager (as a command plugin or build tool plugin), Xcode Package Dependency, Homebrew, CocoaPods, Mint, Bazel, pre-built .pkg installer, and building from source. It also provides a Docker image for containerized usage. Integration options include Xcode build tool plugins and Run Script Build Phases, Visual Studio Code via the vscode-swiftlint extension, Fastlane's swiftlint action, Git pre-commit hooks, and MegaLinter for CI aggregation. The tool can be run from the command line with subcommands for linting, analysis, documentation generation, rule listing, and baseline operations. SwiftLint hooks into SourceKit, allowing it to work across Swift versions without shipping a full compiler. It supports multiple Swift toolchains through environment variables and Xcode toolchain overrides. The project is actively maintained, with contributions encouraged through pull requests, and adheres to the Contributor Covenant Code of Conduct.