Skip to content
Aditya Trivedi edited this page Sep 16, 2015 · 58 revisions

Tailor

Installation

Requires Java (JRE or JDK) Version 8 or above: Java SE Downloads

Mac OS X (10.10+), Linux (Ubuntu, etc.)

curl -fsSL http://tailor.sh/install.sh | sh

Windows (10+)

(New-Object System.Net.WebClient).DownloadString(
"http://tailor.sh/install.ps1") | powershell -command -

You may also download Tailor via GitHub Releases, then unzip, and symlink the tailor/bin/tailor shell script to a location in your $PATH.

Usage

Run Tailor with a list of files and directories to analyze, or via Xcode.

$ tailor [options] [--] [[file|directory] ...]

Help for Tailor is accessible via the [-h|--help] option.

$ tailor -h
Usage: tailor [options] [--] [[file|directory] ...]

Perform static analysis on Swift source files.

Invoking Tailor with at least one file or directory will analyze all Swift files at those paths. If
no paths are provided, Tailor will analyze all Swift files found in '$SRCROOT' (if defined), which
is set by Xcode when run in a Build Phase. Tailor may be set up as an Xcode Build Phase
automatically with the --xcode option.

Options:
    --debug                                    print ANTLR error messages when parsing error occurs
    --except=<rule1,rule2,...>                 run all rules except the specified ones
 -h,--help                                     display help
    --invert-color                             invert colorized console output
 -l,--max-line-length=<0-999>                  maximum Line length (in characters)
    --max-class-length=<0-999>                 maximum Class length (in lines)
    --max-closure-length=<0-999>               maximum Closure length (in lines)
    --max-file-length=<0-999>                  maximum File length (in lines)
    --max-function-length=<0-999>              maximum Function length (in lines)
    --max-name-length=<0-999>                  maximum Identifier name length (in characters)
    --max-severity=<error|warning (default)>   maximum severity
    --max-struct-length=<0-999>                maximum Struct length (in lines)
    --no-color                                 disable colorized console output
    --only=<rule1,rule2,...>                   run only the specified rules
    --show-rules                               show description for each rule
 -v,--version                                  display version
    --xcode=<path/to/project.xcodeproj>        add Tailor Build Phase Run Script to Xcode Project

Features

Cross-Platform

Tailor may be used on Mac OS X via your shell or integrated with Xcode, as well as on Windows and Linux. Great news for when the Swift compiler comes to Linux later this year!

Windows

windows

Linux

Tailor on Ubuntu

Automatic Xcode Integration

Tailor can be integrated with Xcode projects using the --xcode option.

tailor --xcode /path/to/demo.xcodeproj/

Disable violations within Source Code

Violations on a specific line may be disabled with a trailing single-line comment.

import Foundation; // tailor:disable

Colourized Output

Tailor uses the following colour schemes to format CLI output:

  • Dark theme (enabled by default)
dark-color * **Light theme** (enabled via `--invert-color` option) light-color * **No colour theme** (enabled via `--no-color` option) no-color

Environment

Developers

Please review the guidelines for contributing to this repository.

External Tools and Libraries

Development & Runtime

Tool License
ANTLR 4.5 The BSD License
Apache Commons CLI Apache License, Version 2.0
Jansi Apache License, Version 2.0
Xcodeproj MIT

Development Only

Tool License
Gradle Apache License, Version 2.0
Travis CI [Free for Open Source Projects] (https://travis-ci.com/plans)
Mockito MIT
JUnit Eclipse Public License 1.0
Java Hamcrest The BSD 3-Clause License
FindBugs GNU Lesser General Public License
Checkstyle GNU Lesser General Public License
PMD BSD-style
Bundler MIT