File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -201,13 +201,13 @@ configuration, by redirecting it to a file and editing it.
201
201
### Configuring the Command Line Tool
202
202
203
203
For any source file being checked or formatted, ` swift-format ` looks for a
204
- JSON-formatted file named ` .swift-format ` in the same directory. If one is
205
- found, then that file is loaded to determine the tool's configuration.
204
+ JSON-formatted file named ` .no-swift-format ` in the same directory.
205
+ The presence of this file will disable all formatting and linting.
206
+ The contents of ` .no-swift-format ` are ignored - it can be an empty file.
206
207
207
208
If the file is not found, then it looks in the same directory for a file
208
- called ` .no-swift-format ` . The presence of this file will
209
- disable all formatting and linting. The contents of ` .no-swift-format `
210
- are ignored - it can be an empty file.
209
+ called ` .swift-format ` . If one is found, then that file is loaded to
210
+ determine the tool's configuration.
211
211
212
212
If neither configuration file is found, the search for files continues
213
213
in the parent directory, and so on.
Original file line number Diff line number Diff line change @@ -465,14 +465,14 @@ public struct Configuration: Codable, Equatable {
465
465
}
466
466
repeat {
467
467
candidateDirectory. deleteLastPathComponent ( )
468
- let candidateFile = candidateDirectory. appendingPathComponent ( Self . configurationFileName)
469
- if FileManager . default. isReadableFile ( atPath: candidateFile. path) {
470
- return candidateFile
471
- }
472
468
let suppressingFile = candidateDirectory. appendingPathComponent ( Self . suppressionFileName)
473
469
if FileManager . default. isReadableFile ( atPath: suppressingFile. path) {
474
470
return suppressingFile
475
471
}
472
+ let candidateFile = candidateDirectory. appendingPathComponent ( Self . configurationFileName)
473
+ if FileManager . default. isReadableFile ( atPath: candidateFile. path) {
474
+ return candidateFile
475
+ }
476
476
} while !candidateDirectory. isRoot
477
477
478
478
return nil
You can’t perform that action at this time.
0 commit comments