I'd like to use swiftlint to lint a single file. How do I accomplish this? Checking the docs on https://github.com/realm/SwiftLint was not helpful.
Asked
Active
Viewed 5,507 times
3 Answers
23
You can also do this with:
swiftlint --path 'path to your file'

Vladyslav Zavalykhatko
- 15,202
- 8
- 65
- 100
-
1Yup, this is better than my way. – ablarg Sep 05 '17 at 20:47
-
Please notice, `--path` flag is deprecated: https://github.com/realm/SwiftLint/pull/3952 – yo1995 Mar 07 '23 at 00:38
5
SCRIPT_INPUT_FILE_COUNT=1 SCRIPT_INPUT_FILE_0="foo.swift" swiftlint lint --use-script-input-files

ablarg
- 2,400
- 1
- 24
- 32
5
To lint multiple files at once :
$ swiftlint -- file1.swift file2.swift

Axel Guilmin
- 11,454
- 9
- 54
- 64