Home > Net >  Swift swiftlint disable regular expression
Swift swiftlint disable regular expression

Time:05-05

I got this swiftlint error from sonarCube:

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

How can I disable the swiftlint warning from sonarCube?

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

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

CodePudding user response:

It doesn't seem possible in Swift at the moment, but you don't have to name your variables to match response fields. Do you use Codable? If so, it's easy to have any name you wish:

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