thieumao

Custom Rule .swiftlint.yml

Sep 12th, 2017
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.92 KB | None | 0 0
  1. disabled_rules:
  2.   - colon
  3.   - control_statement
  4.   - nesting
  5.   - trailing_whitespace
  6.   - file_header
  7.  
  8. excluded:
  9.   - Carthage
  10.   - Pods
  11.   - External
  12.   - R.generated.swift
  13.  
  14. opt_in_rules:
  15.   - missing_docs
  16.   - force_unwrapping
  17.   - empty_count
  18.   - file_header
  19.   - explicit_init
  20.   - closure_spacing
  21.   - overridden_super_call
  22.   - redundant_nil_coalescing
  23.   - private_outlet
  24.   - nimble_operator
  25.   - attributes
  26.   - operator_usage_whitespace
  27.   - closure_end_indentation
  28.   - first_where
  29.   - sorted_imports
  30.   - object_literal
  31.   - number_separator
  32.   - prohibited_super_call
  33.   - fatal_error_message
  34.  
  35. force_cast: warning # implicitly
  36. force_try:
  37.   severity: warning # explicitly
  38.  
  39. file_length:
  40.   warning: 600
  41.   error: 800
  42. function_body_length:
  43.   warning: 40
  44.   error: 80
  45. function_parameter_count:
  46.   warning: 6
  47.   error: 8
  48. line_length:
  49.   warning: 120
  50.   error: 150
  51. type_body_length:
  52.   warning: 400
  53.   error: 500
  54. cyclomatic_complexity:
  55.   warning: 20
  56.   error: 35
  57. number_separator:
  58.   minimum_length: 5
  59. type_name:
  60.   min_length: 4 # only warning
  61.   max_length: # warning and error
  62.     warning: 40
  63.     error: 50
  64.   excluded: iPhone # excluded via string
  65. identifier_name:
  66.   min_length: # only min_length
  67.     error: 4 # only error
  68.   excluded: # excluded via string array
  69.     - id
  70.     - _id
  71.     - URL
  72.     - GlobalAPIKey
  73. large_tuple: # warn when using 3 values in tuple, give error if there are 4
  74.    warning: 3
  75.    error: 4
  76.  
  77. custom_rules:
  78.   vertical_whitespace_closing_braces:
  79.     included: ".*.swift"
  80.     regex: '\n\s*\n\s*[)}\]]'
  81.     name: "Vertical Whitespace before Closing Braces"
  82.     message: "Don't include vertical whitespace (empty line) before closing braces."
  83.     severity: warning    
  84.   comments_space:
  85.     name: "Space After Comment"
  86.     regex: "(^*//\\w+)"
  87.     message: "There should be a space after //"
  88.     severity: warning
  89.   no_my_identifier:
  90.     name: "No my identifier Rule"
  91.     regex: "([M,m]y^*)"
  92.     match_kinds:
  93.       - identifier
  94.     message: "There should be no my_var, myTable, ...etc here"
  95.     severity: error
  96.   comma_space_rule:
  97.     name: "Expected only one space after comma"
  98.     regex: ",[ ]{2,}"
  99.     match_kinds:
  100.       - comment
  101.     message: "Expected only one space after comma"
  102.   force_https:
  103.     name: "Force HTTPS over HTTP"
  104.     regex: "((?i)http(?!s))"
  105.     match_kinds: string
  106.     message: "HTTPS should be favored over HTTP"
  107.     severity: warning
  108.   empty_line_after_super:
  109.     name: "Empty Line After Super"
  110.     regex: "(^*super\\.[ a-zA-Z0-9=?.\\(\\)\\{\\}:,><!]*\n *(?!(?:\\}|return))\\S+)"
  111.    message: "There should be an empty line after super"
  112.    severity: error
  113.  empty_line_after_guard:
  114.    name: "Empty Line After Guard"
  115.    regex: "(^*guard [ a-zA-Z0-9=?.\\(\\)\\{\\}:,><!]*\n *(?!(?:\\}|return|guard))\\S+)"
  116.    message: "There should be an empty line after a guard"
  117.    severity: error
  118.  
  119. reporter: "xcode" # reporter type (xcode, json, csv, checkstyle)
Advertisement
Add Comment
Please, Sign In to add comment