Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom rules implementation is not working using SwiftLint

I have installed SwiftLint using SwiftLint.pkg in my system. Now I want to customize the rules so I have added .swiftlint.yml file in my root directory. I have added the script. I have followed the steps that are mentioned in the documentation, But somehow it's not working.

Script:

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

Rule in .switlint.yml file :

custom_rules: 
comma_space_rule: 
regex: ",[ ]{2,}" 
message: "Expected only one space after ',"
like image 600
Jaykar Parmar Avatar asked May 04 '26 16:05

Jaykar Parmar


1 Answers

Your rule is fine! 🎉

I tried it and it is working. You just need to indent properly:

custom_rules: 
        comma_space_rule:
                regex: ",[ ]{2,}"
                message: "Expected only one space after ',"
like image 166
Akash Kundu Avatar answered May 06 '26 09:05

Akash Kundu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!