Swiftlint 下划线名称 swift

标签 swift swiftlint

我在我的项目中使用 swiftlint。项目名称是 ABC xx 并且可以与 swiftlint 一起正常工作。现在我决定在我的应用程序中包含 Unitest 并且我必须将 @testable import ABC_xx 导入到 swift 测试文件中,该文件是 class ABC_xxTests: XCTestCase { 不是我在使用 Swiftlinter 时遇到错误,它说 Type Name Violation: Type name should only contain alphanumeric characters: 'ABC_xxTests' (type_name) 我如何对这个错误进行排序

最佳答案

以下 swiftlint 规则允许在 Swift 类名中使用下划线:

type_name:
  allowed_symbols: "_"

编辑: 如果你想为变量名也启用下划线使用:

identifier_name:
  allowed_symbols: "_"

关于Swiftlint 下划线名称 swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54144217/

相关文章:

ios - 工作拉刷新禁用弹跳

ios - 找不到“Firebase/Firebase.h”文件

Swiftlint 覆盖与 SPM 相关的项目设置

SwiftLint 无法识别对 .swiftlint.yml 的更改

ios - Swift - UIPageViewController 中的 UIPinchGestureRecognizer

C 头文件中的 Swift 数学函数

ios - 嵌套违规。类型最多嵌套 1 层深

swift - 如何将 Xcode Assets 文件夹中的图像数组添加到 ViewController?

SwiftLint Rule for Braces 在下一行,但有一些异常(exception)