【发布时间】:2019-09-28 01:03:38
【问题描述】:
是否有可能仅在某些类/方法上禁用 multiline_arguments 规则?
我会写
// swiftlint:disable multiline_arguments
someMethod(self, a: a,
b: b c: c)
// swiftlint:enable multiline_arguments
但是我必须在每次调用中都写它,而这正是我想要避免的。
【问题讨论】:
是否有可能仅在某些类/方法上禁用 multiline_arguments 规则?
我会写
// swiftlint:disable multiline_arguments
someMethod(self, a: a,
b: b c: c)
// swiftlint:enable multiline_arguments
但是我必须在每次调用中都写它,而这正是我想要避免的。
【问题讨论】:
根据你的组织方式,你可以使用嵌套的 SwiftLine yml 文件!
文档是这样说的:
Nested Configurations
SwiftLint supports nesting configuration files for more granular control over the linting process.
Include additional .swiftlint.yml files where necessary in your directory structure.
Each file will be linted using the configuration file that is in its directory or at the deepest level of its parent directories. Otherwise the root configuration will be used.
included is ignored for nested configurations.
【讨论】: