-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'deploy/1.8.0' into productive
- Loading branch information
Showing
17 changed files
with
474 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.0 | ||
4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,162 @@ | ||
opt_in_rules: | ||
- attributes | ||
- closure_end_indentation | ||
- closure_spacing | ||
- empty_count | ||
# - missing_docs | ||
|
||
disabled_rules: | ||
- vertical_whitespace # Turn off until configurable to 2 newlines | ||
- cyclomatic_complexity | ||
- explicit_init | ||
- fatal_error_message | ||
- file_header | ||
- first_where | ||
- implicit_return | ||
- implicitly_unwrapped_optional | ||
- nimble_operator | ||
- no_extension_access_modifier | ||
- number_separator | ||
- operator_usage_whitespace | ||
- overridden_super_call | ||
- private_outlet | ||
- prohibited_super_call | ||
- redundant_nil_coalescing | ||
- switch_case_on_newline | ||
|
||
included: | ||
- Sources | ||
- Tests | ||
|
||
excluded: | ||
- Carthage | ||
- Sources/Constants | ||
- Sources/Code/TextFile.swift | ||
|
||
line_length: 180 | ||
|
||
file_header: | ||
required_pattern: | | ||
\/\/ | ||
\/\/ .*?\.swift | ||
\/\/ [\S ]+ | ||
\/\/ | ||
\/\/ Created by [\S ]+ on \d{1,2}\.\d{1,2}\.\d{2}\. | ||
\/\/ Copyright © \d{4} [\S ]+\. All rights reserved\. | ||
\/\/ | ||
custom_rules: | ||
closing_brace_whitespace: | ||
included: ".*.swift" | ||
regex: '(?:\n| {2,})\}\)? *\n *[^ \n\})\]]' | ||
name: "Closing Brace Whitespace" | ||
message: "Empty line required after closing curly braces if code with same indentation follows." | ||
severity: warning | ||
closure_params_parantheses: | ||
included: ".*.swift" | ||
regex: '\{\s*\([^):]+\)\s*in' | ||
name: "Unnecessary Closure Params Parantheses" | ||
message: "Don't use parantheses around non-typed parameters in a closure." | ||
severity: warning | ||
ending_closure: | ||
included: ".*.swift" | ||
regex: '(?:\(|, | *\S+ *: *)\{[^\}]+\}\) *\n' | ||
name: "Ending Closure" | ||
message: "Don't use '(' and ')' on the last closure of a method – remove them instead." | ||
severity: warning | ||
if_as_guard: | ||
included: ".*.swift" | ||
regex: '\n *if [^\{]+\{\s*return[^\n]*\n *\}(?! *else)' | ||
name: "If as Guard" | ||
message: "Don't use an if statement to just return – use guard for such cases instead." | ||
severity: warning | ||
late_force_unwrapping: | ||
included: ".*.swift" | ||
regex: '\(\S+\?\.\S+\)!' | ||
name: "Late Force Unwrapping" | ||
message: "Don't use ? first to force unwrap later – directly unwrap within the parantheses." | ||
severity: warning | ||
long_switch_case: | ||
included: ".*.swift" | ||
regex: 'case (?:let )?\.[^\n]+\n((?!\s*switch)[^\n\}]+\n){5,}?\s*(case|\})' | ||
name: "Long Switch Cases" | ||
message: "Use a maximum of 3 lines within each case." | ||
severity: warning | ||
missing_docs: | ||
included: ".*.swift" | ||
regex: '\n *(?!\/\/\/)(\/\/)?[^\n\/]*\n *(?:public|open)' | ||
name: "Missing Docs" | ||
message: "Types, properties and methods with public or open access level should be documented." | ||
severity: warning | ||
multiple_closure_params: | ||
included: ".*.swift" | ||
regex: '\} *\) *\{' | ||
name: "Multiple Closure Params" | ||
message: "Don't use multiple in-line closures – save one or more of them to variables instead." | ||
severity: warning | ||
return_whitespace: | ||
included: ".*.swift" | ||
regex: '( {4}\S[^\n]+\n){2,} {4}return|( {8}\S[^\n]+\n){2,} {8}return|( {12}\S[^\n]+\n){2,} {12}return|( {16}\S[^\n]+\n){2,} {16}return|( {20}\S[^\n]+\n){2,} {20}return|( {24}\S[^\n]+\n){2,} {24}return' | ||
name: "Return Whitespace" | ||
message: "Put an empty line before the return line if two or more other lines in closure." | ||
severity: warning | ||
single_line_guard: | ||
included: ".*.swift" | ||
regex: 'guard[^\{]{2,100}else\s*\{\s*\n\s*return.{2,60}\}' | ||
name: "Single Line Guard" | ||
message: "Use a single line guard for simple checks." | ||
severity: warning | ||
space_before_comment: | ||
included: ".*.swift" | ||
regex: '\n[ ]{0}[^\/ \n][^\n]*\n[ ]{0}\/\/|\n[ ]{4}[^\/ \n][^\n]*\n[ ]{4}\/\/|\n[ ]{8}[^\/ \n][^\n]*\n[ ]{8}\/\/|\n[ ]{16}[^\/ \n][^\n]*\n[ ]{16}\/\/|\n[ ]{20}[^\/ \n][^\n]*\n[ ]{20}\/\/|\n[ ]{24}[^\/ \n][^\n]*\n[ ]{24}\/\/' | ||
name: "Space Before Comment" | ||
message: "Always put a space line before a comment line and always comment code beforehand." | ||
severity: warning | ||
too_much_indentation: | ||
included: ".*.swift" | ||
regex: '\n {0}[^\s\/][^\n]*[^,|&]\n+ {5,}\S|\n {4}[^\s\/][^\n]*[^,|&]\n+ {9,}\S|\n {8}[^\s\/][^\n]*[^,|&]\n+ {13,}\S|\n {12}[^\s\/][^\n]*[^,|&]\n+ {17,}\S|\n {16}[^\s\/][^\n]*[^,|&]\n+ {21,}\S|\n {20}[^\s\/][^\n]*[^,|&]\n+ {25,}\S' | ||
name: "Too Much Indentation" | ||
message: "Don't indent code by more than 4 whitespaces." | ||
severity: warning | ||
too_much_unindentation: | ||
included: ".*.swift" | ||
regex: ' {28}\S(.|[^\n]*[^\)][^\ ][^\}])\n+ {0,23}[^\s\/]| {24}\S(.|[^\n]*[^\)][^\ ][^\}])\n+ {0,19}[^\s\/]| {20}\S(.|[^\n]*[^\)][^\ ][^\}])\n+ {0,15}[^\s\/]| {16}\S(.|[^\n]*[^\)][^\ ][^\}])\n+ {0,11}[^\s\/]| {12}\S(.|[^\n]*[^\)][^\ ][^\}])\n+ {0,7}[^\s\/]| {8}\S(.|[^\n]*[^\)][^\ ][^\}])\n+ {0,3}[^\s\/]' | ||
name: "Too Much Unindentation" | ||
message: "Don't unindent code by more than 4 whitespaces." | ||
severity: warning | ||
unnecessary_case_break: | ||
included: ".*.swift" | ||
regex: '(case |default)(?:[^\n\}]+\n){2,}\s*break|\n *\n *break(?:\n *\n|\n *\})' | ||
name: "Unnecessary Case Break" | ||
message: "Don't use break in switch cases – Swift breaks by default." | ||
severity: warning | ||
unnecessary_nil_assignment: | ||
included: ".*.swift" | ||
regex: 'var \S+\s*:\s*[^\s]+\?\s*=\s*nil' | ||
name: "Unnecessary Nil Assignment" | ||
message: "Don't assign nil as a value when defining an optional type – it's nil by default." | ||
severity: warning | ||
vertical_whitespace_between_cases: | ||
included: ".*.swift" | ||
regex: '[^\n{][ \t]*\n[ \t]*(?:case[^\n]+|default):[ \t]*\n' | ||
name: "Vertical Whitespace Between Cases" | ||
message: "Include a vertical whitespace (empty line) between cases in switch statements." | ||
severity: warning | ||
vertical_whitespaces_around_mark: | ||
included: ".*.swift" | ||
regex: '\/\/\s*MARK:[^\n]*(\n\n)|(\n\n\n)[ \t]*\/\/\s*MARK:|[^\s{]\n[^\n\/]*\/\/\s*MARK:' | ||
name: "Vertical Whitespaces Around MARK:" | ||
message: "Include a single vertical whitespace (empty line) before and none after MARK: comments." | ||
severity: warning | ||
vertical_whitespace_opening_braces: | ||
included: ".*.swift" | ||
regex: '[{(\[][ \t]*\n[ \t]*\n' | ||
name: "Vertical Whitespace after Opening Braces" | ||
message: "Don't include vertical whitespace (empty line) after opening braces." | ||
severity: warning | ||
vertical_whitespace_closing_braces: | ||
included: ".*.swift" | ||
regex: '\n[ \t]*\n[ \t]*[)}\]]' | ||
name: "Vertical Whitespace before Closing Braces" | ||
message: "Don't include vertical whitespace (empty line) before closing braces." | ||
severity: warning | ||
whitespace_comment_start: | ||
included: ".*.swift" | ||
regex: '[^:]\/\/[^\s\/]' | ||
name: "Whitespace Comment Start" | ||
message: "A comment should always start with a whitespace." | ||
severity: warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.