集成SwiftLint

1.pod集成代码

pod 'SwiftLint'

2.添加JS代码如下

同时保证将JS放在Sources之前

3.cd到项目根目录下,创建yml文件

touch .swiftlint.yml

4.将规则内容粘贴到yml中

# Yaml doc reference:
#   https://github.com/realm/SwiftLint#disable-rules-in-code
#   https://github.com/realm/SwiftLint/issues/2180

disabled_rules: # rule identifiers to exclude from running
  - trailing_whitespace
  - identifier_name
  - type_name
  - shorthand_operator
  - function_body_length
  - nesting
  - type_body_length
  - cyclomatic_complexity
  - file_length
  - unused_closure_parameter
  - function_parameter_count
  - large_tuple
opt_in_rules: # some rules are only opt-in
excluded: # paths to ignore during linting. Takes precedence over `included`.
  - Pods
  - Vendor
analyzer_rules: # Rules run by `swiftlint analyze` (experimental)
  - explicit_self

# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning # implicitly
force_try:
  severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level implicitly
line_length: 500

 

posted @ 2024-04-23 09:34  zk1947  阅读(5)  评论(0编辑  收藏  举报