ios - SwiftLint 突然停止忽略我的 Pods 文件夹并且它给出了错误
问题描述
我正在一个巨大的快速项目中工作。我正在从 cocoapods 测试 DeviceKit pod,并且直到今天都运行良好。即使是昨天也完美无缺。
现在,突然我无法编译,因为那个类给了我这些错误:
Device.generated.swift:49:8:类型正文长度违规:类型正文应跨越 300 行或更少,不包括注释和空格:当前跨越 447 行(type_body_length)
Device.generated.swift:220:10:标识符名称违规:枚举元素名称应仅包含字母数字字符:'appleWatchSeries0_42mm'(标识符名称)
Device.generated.swift:1150:1:文件行长度违规:文件应包含 400 行或更少:当前包含 1150 (file_length)
这是这个项目中的这个类: https ://github.com/devicekit/DeviceKit/blob/master/Source/Device.generated.swift
我没有碰过这个类,它是一个pod里面的一个类,所以我不明白为什么昨天它编译得很好,现在它没有编译。这怎么可能?
SwiftLint
我的cocoapods pod 文件中有这个版本:
pod 'SwiftLint', '<= 0.20.1' # SwiftLint, para limpieza de código
我尝试将其更新到最新版本,但问题仍然存在。
这是我的.SwiftLint.yml
文件,如您所见,它忽略了 pod:
disabled_rules: # rule identifiers to exclude from running
# - colon
# - comma
- control_statement
- vertical_whitespace
- trailing_whitespace
- discarded_notification_center_observer
opt_in_rules: # some rules are only opt-in
- explicit_init
- fatal_error_message
- first_where
- multiline_parameters
- operator_usage_whitespace
- private_outlet
- cyclomatic_complexity
included: # paths to include during linting. `--path` is ignored if present.
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
# 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
function_body_length:
warning: 50
error: 200
line_length:
warning: 200
error: 300
ignores_function_declarations: true
ignores_comments: true
identifier_name:
min_length:
warning: 3
excluded:
- id
- to
- db
- ad
# they can set both implicitly with an array
type_body_length:
- 300 # warning
- 400 # error
# or they can set both explicitly
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)
解决方案
推荐阅读
- jquery - 页面上没有执行 jquery 命令
- java - 为什么传递原始类型不会给我错误?
- sql-server - 替换动态数据透视 sql 查询中的空值
- ios - iOS 中的可操作通知是仅本地通知还是也可以从服务器发送?
- sql - 在某些表达式后提取某些字符串
- android - FirebaseRemoteConfig 错误“参数键不存在‘字符串’类型的值”
- sql - 在 SQL 中使用贷方付款日期和聚合获取借方的付款日期 - 慢查询
- excel - 从某个单元格跳转 n 个单元格(向下/向上/向右/向左)
- android - 是否可以调用 onMapClick() 而不是 onMarkerClick()?
- python - 将对象检测的结果放入 csv(对象检测教程)