SwiftLint: .swiftlint.yml is completely ignored
I just can’t get the .swiftlint.yml to load, I’ve tried to have it in the root folder of my project, in the built app folder, even in /usr/local/bin but it just won’t load…!
I’ve tried with both a clean build from master branch as well as the 0.4.0 release
swftlint runs as it should but it doesn’t ignore the /Pods and /Carthage folders 😦
My file
excluded: # paths to ignore during linting. overridden byincluded.
- Carthage
- Pods
# parameterized rules can be customized from this configuration file
line_length: 200
# parameterized rules are first parameterized as a warning level, then error level.
type_body_length:
- 300 # warning
- 400 # error
# parameterized rules are first parameterized as a warning level, then error level.
variable_name_max_length:
- 40 # warning
- 60 # error
# parameterized rules are first parameterized as a warning level, then error level.
variable_name_min_length:
- 3 # warning
- 2 # error
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 20
I reinstall
SwiftLint. These are the commands I ran (copy/pasted from my Terminal):When testing this with a new project, everything seems to be working fine. Look like the problem is tied to my existing project. Will dig deeper and report my findings.
In my case, I had to delete spaces before the rules dash, so it looks like this:
Swiftlint 0.34.0 is used.
I have it setup properly as per the README instructions. My file is named
.swiftlint.ymland it is in the root directory of the project, side by side with the.xcworkspace.I tried passing the path to
swiftlintlike this:As you can see, I’m getting an error regarding unrecognized command.
EDIT:
And the version for good form:
I was able to fix it by properly formatting our YAML file.
Notice how the
- trailing_whispacehas 3 spaces instead of 2. Everything seems to be working fine now.Maybe this would be a good enhancement: validate the YAML file if found?