集成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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步