tailor - linter for swift

11
Tailor Linter for Swift

Upload: henrique-morbin

Post on 08-Feb-2017

257 views

Category:

Mobile


1 download

TRANSCRIPT

Tailor

Linter for Swift

What it is?

Tailor is a cross-platform static analysis and lint tool for source code written in Apple's Swift programming language. It analyzes your code to ensure consistent styling and help avoid bugs.

Cross-plataform

● Windows (10+)

● Mac OS X (10.10+)

● Linux

Example

> tailor SettingsViewController.swift

● default (no options)

Example

> tailor --except=trailing-whitespace --max-severity error SettingsViewController.swift

● ignoring white spaces● change severity to error

Rules

●[upper-camel-case] UpperCamelCase naming

●[lower-camel-case] lowerCamelCase naming

●[constant-naming] Constant naming

●[constant-k-prefix] Flag "k-prefixed" constants

●[arrow-whitespace] Flag arrows that are not space delimited

●[angle-bracket-whitespace] Check whitespace in and around angular brackets

●[colon-whitespace] Flag incorrect whitespace around colons

●[comma-whitespace] Flag commas that are not left associated

●[operator-whitespace] Flag operators that are not space delimited (only in operator declarations)

●[leading-whitespace] Flag leading whitespace in a file

●[parentheses-whitespace] Check whitespace in and around parenthesis

●[terminating-newline] Single newline at end of source file

●[trailing-whitespace] Flag trailing whitespace

●[comment-whitespace] Comment whitespace checks

●[function-whitespace] Blank lines around functions

Naming Whitespace

Rules

●Restrict number of lines per file and construct body

○[max-class-length]○[max-closure-length]○[max-file-length]○[max-function-length]○[max-struct-length]

●Restrict number of characters per line and construct name

○[max-line-length]○[max-name-length]○[min-name-length]

●[redundant-parentheses] Flag redundant parentheses

●[brace-style] One true brace style

●[forced-type-cast] Flag force casts

●[multiple-imports] One import per line

●[terminating-semicolon] Flag semicolon terminated statements

●[todo-syntax] Verify TODO syntax

●[redundant-optional-binding] Flag redundant let/var bindings in optional binding lists

●[trailing-closure] Closures that are the last argument of a function should be passed using 'trailing closure' syntax.

Length Others

Xcode Integration● Run a command in Terminal

● Result in Xcode

Xcode Integration● Build time

Fastlane + Tailor