【问题标题】:pod not excluded while lint with swift lint使用 swift lint 进行 lint 时不排除 pod
【发布时间】:2019-05-26 04:34:57
【问题描述】:

我已将 swiftLint 添加到我的项目中,还添加了 .swiftlint.yml 文件,其中包含所有规则,但某些文件规则在我的项目中不起作用,例如排除和行长。我想从 Linting 中排除 pod,所以我在 .swiftlint.yml 文件中添加了以下代码

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

在我的 .yml 文件中,但 pods 仍然没有被忽略。

任何人都知道我在哪里做错了。

提前致谢

【问题讨论】:

  • 你的问题解决了吗?
  • 你能解决这个问题吗?

标签: ios iphone swiftlint


【解决方案1】:

例如, 您的.yml 文件应如下所示,它具有opt_in_rulesdisabled_rulesfile_lengthtype_body_lengthidentifier_nameline_lengthnumber_separatorfunction_parameter_count 规则,

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

希望对你有帮助。

【讨论】:

  • 是的,我的 .yml 文件与您提到的相同,并且我还添加了 exclude 以排除 pods。这是我添加的代码 'excluded: #paths to ignore during linting。优先于included。 - 迦太基 - 豆荚
猜你喜欢
  • 2019-09-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-27
  • 2015-11-21
  • 2019-02-15
  • 1970-01-01
相关资源
最近更新 更多