Search code examples
swiftswiftlint

What exactly does 'Type Body Length' mean in Swiftlint?


We just added Swiftlint to our project and we want to follow all the rules but I'm not sure what's meant by 'type_body_length' warning. I'm not a native english speaker so I find it a bit confusing.

There is a rule for file length aswell so how do they differ? What falls under this definition?

enter image description here


Solution

  • type_body_length violation means that the class has too many lines in it. I dont think it counts extensions, comments or whitespace

    Type name should only contain alphanumeric characters, start with an uppercase character and span between 3 and 40 characters in length.

    The rules documentation linked here and above also gives examples of what would and wouldn't be accepted (Triggering & Non Triggering). - Edit suggested by @GoodSp33d, thanks