I am a great fan of Faux Pas , an awesome code quality tool for objC. Now when I shifted to Swift, I was looking for a similar tool and I found SwiftLint, which is an awesome tool. Its pretty easy to install, I downloaded the pkg file and installed and added the runscript to make it work.

Now the problem was that I wanted to turn off some of the rules and for that I need to create a .swiftlint.yml file, but how the hell to create it? Mac is throwing error if I give “.” at the start of file and now this is what I did.

1. Copied all the rules in to a file named swiftlint.yml (not with the starting “.”)
2. I Copied the file to the project root folder, where your proj file is present.
3. Then via terminal go the root folder. (cd /Users/SourceCode/MySampleApp…)
4. Hit this command “mv swiftlint.yml .swiftlint.yml”, this will create “.swiftlint.yml” file and immediately it becomes hidden, now you need to use terminal to do any changes.
5. Use “vi .swiftlint.yml” to edit.
6. After that you just need to move all the rules you want to disable, into the “disabled-rules” section.

`UPDATE`: You can use Atom editor which displays all files that start with “.”

You may get annoyed with the trailing space warnings, but dont worry SwiftLint has an autocorrect feature, you need to hit “swiftlint autocorrect” command and ta da and almost everything is fixed automatically.

You can use your custom swiftlint config, first copy your config into the project root folder and in the runscript add this

if which swiftlint >/dev/null; then
swiftlint lint --config ${SRCROOT}/.swiftlint.yml
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

Enjoy….code with Quality…