-
-
Save PetrPrazak/158b8f77a950bdc5b5ba5b19a0ca5e95 to your computer and use it in GitHub Desktop.
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
# MonoRepo | |
excluded: # paths to ignore during linting. Takes precedence over `included`. | |
- "*/Carthage" | |
- "*/Pods" | |
- "*/RingEventSchema" | |
- "*/RingSchema" | |
- "*/Ring/GeneratedMocks.swift" | |
- "*/RingApi/Endpoint.swift" | |
disabled_rules: # rule identifiers to exclude from running | |
# Intentionally disabled rules (disagree with blanket application of rule principle): | |
- closure_parameter_position | |
- cyclomatic_complexity | |
- empty_enum_arguments | |
- force_cast | |
- force_try | |
- line_length | |
- file_length | |
- nesting | |
- notification_center_detachment | |
- type_body_length | |
- unused_closure_parameter | |
- xctfail_message | |
# Disabled because of problem with the rule: | |
- class_delegate_protocol # does not consider if inherited protocol name contains, rather than ends in "Delegate" https://github.com/realm/SwiftLint/issues/3311 | |
opt_in_rules: # some rules are only opt-in | |
- empty_count | |
- multiline_arguments | |
- multiline_parameters | |
# Find all the available rules by running: | |
# swiftlint rules | |
analyzer_rules: | |
# - unused_private_declaration | |
- unused_import | |
# configurable rules can be customized from this configuration file | |
# binary rules can set their severity level | |
block_based_kvo: | |
severity: warning # Currently 4 cases in Ring | |
class_delegate_protocol: | |
severity: error | |
discarded_notification_center_observer: | |
severity: error | |
for_where: | |
severity: error | |
function_body_length: | |
warning: 100 | |
function_parameter_count: | |
warning: 20 | |
error: 20 | |
generic_type_name: | |
max_length: | |
warning: 30 # default = 20 | |
error: 30 # default = 10000 | |
identifier_name: | |
allowed_symbols: ["_"] | |
validates_start_with_lowercase: false # This is to allow "_" prefix. validates_start_with_lowercase happens in identifier__name custom rule | |
min_length: | |
warning: 1 | |
max_length: | |
warning: 100 | |
excluded: | |
- _id | |
- _none | |
- _protocol | |
- id | |
- ID | |
- URL | |
large_tuple: | |
warning: 3 | |
error: 3 | |
multiline_arguments: | |
severity: error | |
multiline_parameters: | |
severity: error | |
multiple_closures_with_trailing_closure: | |
severity: error | |
no_fallthrough_only: | |
severity: error | |
private_over_fileprivate: | |
validate_extensions: true | |
trailing_whitespace: | |
ignores_empty_lines: true | |
ignores_comments: true | |
# naming rules can set warnings/errors for min_length and max_length | |
# additionally they can set excluded names | |
type_name: | |
allowed_symbols: ["_"] | |
min_length: 3 # only warning | |
max_length: # warning and error | |
warning: 80 | |
error: 100 | |
excluded: | |
- iPhone | |
- Me | |
- ID | |
unused_enumerated: | |
severity: error | |
unused_optional_binding: | |
severity: error | |
vertical_whitespace: | |
max_empty_lines: 2 | |
weak_delegate: | |
severity: error | |
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji) | |
custom_rules: | |
implicitly_unwrapped_optional_delegate: # Rule identifier | |
included: ".*\\.swift" # regex that defines paths to include during linting. optional. | |
name: "Implicitly unwrapped optional delegate" # rule name. optional. | |
regex: "var[ \t]*([a-zA-Z0-9]*)[D,d]elegate[ \t]*:[ \t]*[a-zA-Z0-9]*!" | |
message: "Delegate vars should be declared weak and optional" # violation message. optional. | |
severity: error | |
class__delegate__protocol: # Rule identifier | |
included: ".*\\.swift" # regex that defines paths to include during linting. optional. | |
name: "Class Delegate Protocol" # rule name. optional. | |
regex: "protocol[ \t]*([a-zA-Z0-9]*[D,d]elegate[a-zA-Z0-9]*)[ \t]*:[ \t]++(?!(class|AnyObject|[a-zA-Z0-9.]*[D,d]elegate[a-zA-Z0-9]*))" | |
message: "Delegate protocols should be class-only so they can be weakly referenced." # violation message. optional. | |
severity: error | |
identifier__name: # This is to check that identifier names begin with lowercase or "_", which can't be done in the default identifier_name rule | |
included: ".*\\.swift" # regex that defines paths to include during linting. optional. | |
name: "Identifier Name" # rule name. optional. | |
regex: "(?<!static|class)[ \t]++(?:let|var|func)(?:[ \t]++)([^a-z_.(][a-zA-Z0-9)]++(?<![A-Z0-9]))(?:[{():= \t])" | |
message: "Identifier names should only contain alphanumeric characters and start with a lowercase character or _, or should only contain upper case letters." # violation message. optional. | |
severity: error | |
# constant_naming_convention: # rule identifier | |
# included: ".*\\.swift" # regex that defines paths to include during linting. optional. | |
# name: "Constant naming convention" # rule name. optional. | |
# regex: "let[ \t]*(k[A-Z][a-zA-Z0-9]*)[ \t]*:?[ \t]*[a-zA-Z0-9]*[ \t]*=" | |
# message: "k* naming convention for constants is discouraged" # violation message. optional. | |
# severity: warning |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment