-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
use_nested_configs: true ignores rule in "main" .swiftlint.yml #675
Comments
We deprecated support for Now nested configurations are always considered when present, but that still doesn't explain the behavior you're seeing. I'll try seeing if I can reproduce this. |
@jpsim thanks for quick response, didn't know that |
I can't reproduce this: $ tree -a
.
├── .swiftlint.yml
├── test.swift
└── tests
└── .swiftlint.yml
$ cat test.swift
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
$ cat .swiftlint.yml
line_length: 110
$ cat tests/.swiftlint.yml
disabled_rules:
- force_cast
- force_try
$ swiftlint
Loading configuration from '.swiftlint.yml'
Linting Swift files in current working directory
Linting 'test.swift' (1/1)
Done linting! Found 0 violations, 0 serious in 1 file.
$ swiftlint version
0.10.0 The What are you doing differently? Did I miss a step? |
That's odd, since SwiftLint logs the following message when you include that key in a config file:
Are you sure you're using SwiftLint 0.10.0? |
Yes,
I didn't run it from command line, I'm using Xcode Run Script Phase for that.
Finally I figured out what the difference: swiftlint generates this warnings for files in |
Yes, nested configurations replace their parents. There's room for more intelligent merging of configurations, which we have commented in the code (link) but I can't find an issue that's currently tracking that. I've filed #676 to track that improvement. If you're interested in contributing to SwiftLint, that'd be a great place to start! Feel free to close this issue if you feel I've sufficiently addressed your questions 😄 |
@jpsim Thank you for your help! |
I'm using SwiftLint 0.10.0
In my project I have 2
.swiftlint.yml
: inMyProject/
and inMyProject/MyProjectTests/
folders.And SwiftLint generates warnings in whole project, ignoring rule from first
.swiftlint.yml
:The text was updated successfully, but these errors were encountered: