Ios 在swift 4中实施入住政策

Ios 在swift 4中实施入住政策,ios,swift,xcode,github-codereviews,Ios,Swift,Xcode,Github Codereviews,假设我有一个这样的类: class person{ } 我需要实现一个策略来检查我的代码,并使用驼峰大小写作为类名警告我(使用Person而不是Person) 如何在Swift中执行此操作?我认为您可以使用SwiftLint进行各种编码指导,并且您可以在yml文件中设置规则,有关详细信息,请参阅 例如,yml文件如下所示: opt_in_rules: - force_unwrapping - empty_count - explicit_init - closure_spaci

假设我有一个这样的类:

class person{
}
我需要实现一个策略来检查我的代码,并使用驼峰大小写作为类名警告我(使用Person而不是Person)
如何在Swift中执行此操作?

我认为您可以使用
SwiftLint
进行各种编码指导,并且您可以在
yml
文件中设置规则,有关详细信息,请参阅

例如,
yml
文件如下所示:

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

我认为您可以使用
SwiftLint
进行各种编码指导,您可以在
yml
文件中设置规则,详情请参阅

例如,
yml
文件如下所示:

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