【发布时间】:2018-12-25 08:20:24
【问题描述】:
假设我有这样的课程:
class person{
}
我需要实施一项政策来检查我的代码并警告我使用驼峰式大小写作为我的类名(使用 Person 而不是 person) 如何在 Swift 中做到这一点?
【问题讨论】:
标签: ios swift xcode github-codereviews
假设我有这样的课程:
class person{
}
我需要实施一项政策来检查我的代码并警告我使用驼峰式大小写作为我的类名(使用 Person 而不是 person) 如何在 Swift 中做到这一点?
【问题讨论】:
标签: ios swift xcode github-codereviews
我认为您使用SwiftLint 来编写各种编码指南,您可以在yml 文件中设置规则,请参阅SwiftLint 了解更多详情
例如,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
【讨论】: