Search code examples
swiftswiftlint

Extra command for swiftlint necessary after autocorrecting?


Is it necessary to call both of these lines?

swiftlint --autocorrect --format
swiftlint

I've seen this in some example code but for me it looks like the first line does does listing and shows the warnings/errors and afterwards corrects and formats them. So to me the second like looks like it it's redundant.


Solution

  • The first lines lists and corrects the code and also formats it (same as doing ctrl+i in Xcode). So to me it looks like the purpose of the second line is to again validate the code after it has been formatted.

    Is it necessary? Well that is completely subjective isn't it?

    Also not that --autocorrect is deprecated and have been replaced by --fix so the above command is now

    swiftlint --fix --format