Swift swiftlint 禁用正则表达式

Swift swiftlint disable regular expression

我从 sonarCube 收到这个 swiftlint 错误:

Rename this constant to match the regular expression ^[a-z][a-zA-Z0-9]*$.".

如何禁用来自 sonarCube 的 swiftlint 警告?

// Rename this constant to match the regular expression ^[a-z][a-zA-Z0-9]*$.

let zht: [item]
let en: [item]
let zhs: [item]

目前 doesn't seem possible in Swift,但您不必为变量命名以匹配响应字段。你用Codable吗?如果是这样,很容易得到任何你想要的名字:

struct YourModel: Decodable {
  enum CodingKeys: String, CodingKey {
    case wantedName = "unwantedNameFromResponse"
  }
  let wantedName: String
}