SwiftLint: Nested Configuration Not Working?
Nested configuration doesn’t seem to be working for me – not sure why, not much information to go on.
I have a test that does some force_trys, and since it’s a test, I’m ok with that. It’ll fail fast, easy to read. So I thought I might disable force_try rule in the test folder, but I’m not having any luck. It’s entirely possible that I’ve done something wrong, but I’m not sure what. Would SwitLint print anything if it picked up the nested configuration? If so, it isn’t doing that.
$ swiftlint
Loading configuration from '.swiftlint.yml'
Linting Swift files in current working directory
Linting 'Action.swift' (1/32)
Linting 'APIManager.swift' (2/32)
Linting 'Data.swift' (3/32)
Linting 'DateFormatter.swift' (4/32)
Linting 'ErrorParser.swift' (5/32)
Linting 'Gender.swift' (6/32)
Linting 'HTTPManager.swift' (7/32)
Linting '<Redacted>.swift' (8/32)
Linting 'HTTPMethod.swift' (9/32)
Linting 'Log.swift' (10/32)
Linting 'LogLevel.swift' (11/32)
Linting 'NSNull.swift' (12/32)
Linting 'OptionalAny.swift' (13/32)
Linting '<Redacted>Error.swift' (14/32)
Linting '<Redacted>Manager.swift' (15/32)
Linting 'Profile.swift' (16/32)
Linting 'Result.swift' (17/32)
Linting 'Summary.swift' (18/32)
Linting 'Zone.swift' (19/32)
Linting 'ZoneInfo.swift' (20/32)
Linting 'APIManagerTests.swift' (21/32)
Linting 'DataTests.swift' (22/32)
Linting 'ErrorParserTests.swift' (23/32)
Linting 'Extensions.swift' (24/32)
Linting 'GenderTests.swift' (25/32)
Linting '<Redacted>Tests.swift' (26/32)
Linting 'HTTPManagerTests.swift' (27/32)
Linting 'LogTests.swift' (28/32)
Linting 'Mocks.swift' (29/32)
Linting '<Redacted>ManagerTests.swift' (30/32)
<Redacted>/SDK/Tests/Unit/DataTests.swift:11:23: error: Force Try Violation: Force tries should be avoided. (force_try)
<Redacted>/SDK/Tests/Unit/DataTests.swift:16:23: error: Force Try Violation: Force tries should be avoided. (force_try)
<Redacted>/SDK/Tests/Unit/DataTests.swift:22:23: error: Force Try Violation: Force tries should be avoided. (force_try)
<Redacted>/SDK/Tests/Unit/DataTests.swift:28:23: error: Force Try Violation: Force tries should be avoided. (force_try)
<Redacted>/SDK/Tests/Unit/DataTests.swift:34:23: error: Force Try Violation: Force tries should be avoided. (force_try)
Linting 'ResultTests.swift' (31/32)
Linting 'ZoneTests.swift' (32/32)
Done linting! Found 5 violations, 5 serious in 32 files.
$ cat Tests/.swiftlint.yml
disabled_rules:
# Simplifies tests, limited harm in test code.
- force_try
Am I doing something wrong? If so, I don’t know what. I’m not even sure if it’s detecting the .swiftlint.yml in the Tests folder.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 5
- Comments: 16 (3 by maintainers)
This is a bug in the caching mechanism. We’re tracking many such cases in #1184 but I do want to keep this one explicitly open too as it might contain information that isn’t covered in #1184.