Merge pull request #178 from TouchInstinct/swiftlint_rules

Swiftlint rules
This commit is contained in:
MRSorokinMaxim 2020-04-13 13:22:18 +03:00 committed by GitHub
commit c957a38784
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 1 deletions

View File

@ -207,6 +207,26 @@ custom_rules:
- string_interpolation_anchor
- typeidentifier
getter_setter_style:
name: "Wrong getter/setter code style"
regex: "(get|set|willSet|didSet) \\{ [.]*"
match_kinds:
- keyword
message: "Make a new line break when use getter or setter"
severity: error
redundant_boolean_condition:
name: "Redundant Boolean Condition"
regex: "(== true)|(== false)|(!= true)|(!= false)"
message: "Comparing a boolean to true is redundant (use `?? false` for optionals), and `!`-syntax is preferred over comparing to false."
severity: error
redundant_ternary_operator:
name: "Redundant Ternary Operator"
regex: "(\\? true \\: false)|(\\? false \\: true)"
message: "Returning a boolean as true is redundant, and `!`-syntax is preferred over returning as false."
severity: error
# Rx
unused_map_parameter:
@ -222,4 +242,3 @@ custom_rules:
regex: '(^\s*\w*\.?)(addSubview)\([\w]+\)\n\1\2'
message: "Replace multiple addSubview calls with single addSubviews."
severity: warning