SwiftLint 警告:配置包含无效键:["function_level"]

问题描述

Jus 更新了 Pod 并收到警告

warning: Configuration contains invalid keys:
["function_level"]

根据 CHANGELOG 更改了 .swiftlint.yml

内部:.swiftlint.yml


colon:
  severity: error

line_length:
  ignores_comments: true
  warning: 260
  error: 300

type_body_length:
  warning: 300
  error: 500

file_length:
  warning: 800
  error: 1000

function_parameter_count:
  warning: 20
  error: 30

function_body_length:
  warning: 120
  error: 150
  
cyclomatic_complexity:
  warning: 40
  error: 50
  
disabled_rules:
 - implicit_getter
 - redundant_string_enum_value
 
nesting:
  type_level:
     warning: 3
     error: 6
function_level:
   warning: 5
   error: 10

#implicitly_unwrapped_optional:
#  severity: warning

force_unwrapping:
  severity: error

vertical_whitespace:
  severity: error

#optional_try:
#  severity: error

force_try:
  severity: error
  
type_name:
    min_length: 3
    max_length: 60
    error: 80
  
identifier_name:
    min_length: 1
    max_length: 60
    excluded:
    - id

# disable rules from the default enabled set.
disabled_rules:
  - trailing_whitespace
  - implicit_getter
  - redundant_string_enum_value
  - switch_case_alignment

# Enable rules not from the default set.
opt_in_rules:
  # - function_default_parameter_at_end
  - empty_count
  # - index_at_zero
  - legacy_constant
#  - implicitly_unwrapped_optional
  - force_unwrapping

# Acts as a whitelist,only the rules specified in this list will be enabled. Can not be specified alongside disabled_rules or opt_in_rules.
only_rules:

# This is an entirely separate list of rules that are only run by the analyze command. All analyzer rules are opt-in,so this is the only configurable rule list (there is no disabled/whitelist equivalent).
analyzer_rules:

# This section is for defining custom rules
# custom_rules:
  # constant_zero:
  #   included: ".*\\.swift"
  #   excluded: ".*Test\\.swift"
  #   name: "Constant Zero"
  #   regex: "(^0$)"
  #   match_kinds:
  #     - number
  #   message: "Use .zero instead of 0"
  #   severity: warning

  # optional_try:
  #   included: ".*\\.swift"
  #   excluded: ".*Test\\.swift"
  #   name: "Optional Try"
  #   regex: ".*try?.*"
  #   match_kinds:
  #     - idiomatic
  #   message: "Optional tries should be avoided."
  #   severity: warning

# paths to ignore during linting. Takes precedence over `included`.
excluded:
  - Carthage
  - Pods

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)