Swift swiftlint disable regular expression

255 Views Asked by At

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]
1

There are 1 best solutions below

2
On BEST ANSWER

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
}