Skip to content

Instantly share code, notes, and snippets.

@antonyalkmim
Created September 19, 2017 17:08
Show Gist options
  • Save antonyalkmim/3d126b386ed847cd863dbf72de287029 to your computer and use it in GitHub Desktop.
Save antonyalkmim/3d126b386ed847cd863dbf72de287029 to your computer and use it in GitHub Desktop.
Swift Lint Rules
opt_in_rules: # some rules are only opt-in
# - missing_docs
- attributes
- closure_end_indentation
- closure_spacing
- empty_count
- explicit_init
- explicit_top_level_acl
- extension_access_modifier
- fatal_error_message
- multiline_parameters
- vertical_parameter_alignment_on_call
- first_where
- force_unwrapping
- implicit_return
- implicitly_unwrapped_optional
- joined_default_parameter
- let_var_whitespace
- nimble_operator
- no_grouping_extension
- number_separator
- object_literal
- operator_usage_whitespace
- overridden_super_call
- pattern_matching_keywords
- private_outlet
- private_over_fileprivate
- prohibited_super_call
- quick_discouraged_call
- redundant_nil_coalescing
- single_test_class
- sorted_imports
- switch_case_on_newline
- trailing_closure
- unneeded_parentheses_in_closure_argument
# Find all the available rules by running:
# swiftlint rules
# https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Attributes.html
attributes:
always_on_same_line:
- "@IBAction"
- "@IBInspectable"
- "@IBDesignable"
- "@IBOutlet"
- "@NSManaged"
- "@discardableResult"
- "@GKInspectable"
- "@nonobjc"
- "@NSCopying"
- "@objc"
always_on_line_above:
- "@available"
- "@NSApplicationMain"
- "@testable"
- "@UIApplicationMain"
included: # paths to include during linting. `--path` is ignored if present.
- Sources
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: error # implicitly
force_try:
severity: error # explicitly
# rules that have both warning and error levels, can set just the warning level
# implicitly
line_length: 120
# they can set both implicitly with an array
type_body_length:
- 300 # warning
- 400 # error
# or they can set both explicitly
file_length:
warning: 500
error: 1000
ignore_comment_only_lines: true
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
generic_type_name:
min_length: 1
max_length:
warning: 40
error: 64
type_name:
min_length: 4 # only warning
max_length: # warning and error
warning: 40
error: 64
excluded:
- Log
identifier_name:
min_length: # only min_length
error: 3 # only error
excluded:
- op
- id
- key
- URL
- url
- GlobalAPIKey
nesting:
type_level:
warning: 3
error: 5
statement_level:
warning: 5
error: 6
statement_position:
statement_mode: uncuddled_else
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)
object_literal:
code_literal: false
image_literal: false
color_literal: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment