0

I have added swiftLint to my Project and also added .swiftlint.yml file with all rules but some of rule of file not working in my project like excluded and line length. i want to exclude pod from Linting so i have added following code in .swiftlint.yml file

excluded: # paths to ignore during linting. Takes precedence overincluded. - Carthage - Pods

in my .yml file but pods is still not ignore.

Anyone have any idea where i done mistake.

Thanks in Advance

Hardik Baldha
  • 159
  • 1
  • 14

2 Answers2

0

For example, Your .yml file should look like below, It has opt_in_rules, disabled_rules, file_length, type_body_length, identifier_name, line_length, number_separator, function_parameter_count rules,

excluded:
  - Carthage
  - Pods
opt_in_rules:
  - force_unwrapping
  - empty_count
  - explicit_init
  - closure_spacing
  - overridden_super_call
  - redundant_nil_coalescing
  - nimble_operator
  - attributes
  - operator_usage_whitespace
  - closure_end_indentation
  - first_where
  - object_literal
  - number_separator
  - prohibited_super_call
  - fatal_error_message
disabled_rules:
  - type_name
  - trailing_whitespace
  - identifier_name
  - class_delegate_protocol
  - nesting
file_length:
  warning: 1000
  error: 1200
type_body_length:
 - 200 # warning
 - 300 # error
identifier_name:
  excluded:
    - id
line_length: 300
number_separator:
  minimum_length: 5
function_parameter_count:
  warning: 6
  error: 9

Hope it helps.

Bappaditya
  • 9,494
  • 3
  • 20
  • 29
  • yes my .yml file is same as u mentioned and i also added excluded to exclude pods.here is code i have added 'excluded: # paths to ignore during linting. Takes precedence over `included`. - Carthage - Pods – Hardik Baldha Dec 31 '18 at 04:56
0

Below worked for me:

Move .swiftlint.yml file a level up in the directory structure. Your SwiftLint file should look like below:

included: 
- YourAppFolderName

excluded:
- Carthage
- Pods

Hope this helps someone.

Rishi
  • 743
  • 8
  • 17