Swift Lint (
swift-lint) is a static code analysis tool for improving quality and reducing
defects by inspecting Swift code and looking for
potential problems, such as possible bugs, unused code, complicated code, redundant
code, code smells, bad practices, and so on.
Swift Lint relies on Swift Abstract Syntax Tree (
of the source code for better accuracy and efficiency.
Swift Lint is part of Yanagiba Project. Yanagiba umbrella project is a toolchain of compiler modules, libraries, and utilities, written in Swift and for Swift.
- Usage and Documentation
A Work In Progress
Both Swift Abstract Syntax Tree and Swift Lint are in active development. Though many features are implemented, some are with limitations.
Swift Lint doesn't modify your code, therefore, the tool is safe to be deployed in production environment while we are working hard towards 1.0 release. Please be cautious with bugs, edge cases and false positives (issues and pull requests are welcomed).
To use it as a standalone tool, clone this repository to your local machine by
git clone https://github.com/yanagiba/swift-lint
Go to the repository folder, run the following command:
swift build -c release
This will generate a
swift-lint executable inside
swift Path (Recommended, but Optional)
It is recommended to copy the
swift-lint to the same folder that your
swift binary resides.
For example, if
swift is installed at (Linux) or the toolchain (macOS)'s
bin path is
swift-lint to it by
cp .build/release/swift-lint /Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-lint
Once you have done this, you can invoke
swift lint in your terminal directly.
Embed Into Your Project
swift-lint dependency to your Swift Package Manager (SPM) dependencies in
// swift-tools-version:4.0 import PackageDescription let package = Package( name: "MyPackage", dependencies: [ .package(url: "https://github.com/yanagiba/swift-lint.git", from: "0.2.2") ], targets: [ .target(name: "MyTarget", dependencies: ["SwiftMetric", "SwiftLint"]), ], swiftLanguageVersions:  )
An example project will be added in the future.
Usage & Documentation
Simply provide the file paths to
swift-lint path/to/Awesome.swift swift-lint path1/to1/foo.swift path2/to2/bar.swift ... path3/to3/main.swift
swift-lint --help to get the updated command line options.
Go to Documentation for details.
Build & Run
Building the entire project can be done by simply calling:
This is equivalent to
The dev version of the tool will be generated to
Compile and run the entire tests by:
Swift Lint is available under the Apache License 2.0. See the LICENSE file for more info.