Well, if you donβt want specific rules to apply to a particular file, you can use the technique mentioned by @Benno Kress. To do this, you need to add a comment to your swift file as follows.
Rules will be disabled until the end of the file or until the linter sees the corresponding inclusion comment:
// swiftlint:disable <rule1> YOUR CODE WHERE NO rule1 is applied // swiftlint:enable <rule1>
You can also skip some files by setting up swiftlint. Add the " .swiftlint.yml " file to the directory where you will run SwiftLint.
Add the following content to exclude some files. Let's say file1, file2 ... etc.
excluded: - file1 - file2 - folder1 - folder1/ExcludedFile.swift
To disable some rules, completely add the following to the same " .swiftlint.yml " file .
disabled_rules:
For more information, refer to the following links.
https://swifting.io/blog/2016/03/29/11-swiftlint/
https://github.com/realm/SwiftLint#disable-rules-in-code
arango_86
source share