Search code examples
iosswiftlint

Suppressing variable name length from protocols in frameworks


We are using Ad frameworks in our iOS application and integrated SwiftLint as part of the code. We noticed that some protocols from the Ad framework have variable length 2. Example is:

func ad(_ ad: Any!, requestFailedWithError error: Error!)

As variable length is 2, SwiftLint is throwing warnings. How can I suppress these warnings in yml file? Or is there any better way to handle these warnings?


Solution

  • I suggest you to disable the warning each times you implement the method:

    // swiftlint:disable:next variable_name
    func ad(_ ad: Any!, requestFailedWithError error: Error!)
    

    If you disable the rule inside the yml config file you'll disable it for your whole project and you should not do that.