Skip to content

Instantly share code, notes, and snippets.

@felginep
Created January 12, 2017 09:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felginep/5f0160793389060ddf778942ed96c8ad to your computer and use it in GitHub Desktop.
Save felginep/5f0160793389060ddf778942ed96c8ad to your computer and use it in GitHub Desktop.
disabled_rules: # rule identifiers to exclude from running
# not sure
- closure_parameter_position
- unused_closure_parameter
- operator_whitespace # what about defining func ==()
- colon
# - force_cast
# - force_try
# useless
- todo
- variable_name
- type_name #not_sure
- mark #could_be_used (~trivial but still)
- line_length #could_be_used (needs to be configured)
- function_body_length
- cyclomatic_complexity
opt_in_rules:
- closure_end_indentation
- closure_spacing
- empty_count
- explicit_init
- first_where
- forced_unwrapping
- operator_usage_whitespace
- private_outlet
- switch_case_on_newline
force_cast: warning
force_try: warning
empty_count: warning
custom_rules:
double_space:
include: "*.swift"
name: "Double space"
regex: "([a-z,A-Z] \s+)"
message: "Double space between keywords"
match_kinds: keyword
severity: warning
boolean_operators_end_of_line:
include: "*.swift"
name: "Boolean Operators"
regex: "((?:&&|\|\|)$)"
message: "Boolean operators should not be at the end of line"
severity: warning
explicit_failure_calls:
name: "Avoid asserting 'false'"
regex: "((assert|precondition)\(false)"
message: "Use assertionFailure() or preconditionFailure() instead."
severity: warning
multiple_empty_lines:
name: "Multiple Empty Lines"
regex: "((?:\s*\n){3,})"
message: "There are too many line breaks"
severity: warning
marks_style:
name: "Marks"
regex: "(//?[ ]MARK: -?[a-zA-Z0-9])"
message: "Marks should follow the following structure: // MARK: - Comment."
severity: warning
comments_space:
name: "Space After Comment"
regex: "(^ *//(?!(MARK|TODO))\w+)"
message: "There should be a space after //"
severity: warning
unnecessary_type:
name: "Unnecessary Type"
regex: "[ a-zA-Z0-9]*(?:let|var) [ a-zA-Z0-9]*: ([a-zA-Z0-9]*)[\? ]*= \1\("
message: "Type Definition Not Needed"
severity: warning
# ex:
# - KO: let type: Type = Type()
# - OK: let type: Type = Type.staticVar
# class_func:
# name: "class func usage"
# regex: "^\s*class\s+func\s+"
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment