From 18f30da80eeed1cc4afae14a3a62e4da5ddcf080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mro=CC=81z?= Date: Mon, 2 Apr 2018 23:21:48 +0200 Subject: [PATCH] Fix #6. Documentation for configFile/directory parameters --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index c4829db..f626811 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,17 @@ If you want the lint result shows in diff instead of comment, you can use inline SwiftLint.lint(inline: true) ``` +#### Config & Directory + +You can also specify a path to the config file using `configFile` parameter and a path to the directory you want to lint using `directory` parameter. This is helpful when you want to have different config files for different directories. E.g. Harvey wants to lint test files differently than the source files, thus they have the following setup: + +```swift +SwiftLint.lint(directory: "Sources", configFile: ".swiftlint.yml") +SwiftLint.lint(directory: "Tests", configFile: "Tests/HarveyTests/.swiftlint.yml") +``` + +It's not possible to use [nested configurations](https://github.com/realm/SwiftLint#nested-configurations), because Danger SwiftLint lints each file on it's own, and by doing that the nested configuration is disabled. If you want to learn more details about this, read the whole issue [here](https://github.com/ashfurrow/danger-swiftlint/issues/4). + # Contributing If you find a bug, please [open an issue](https://github.com/ashfurrow/danger-swiftlint/issues/new)! Or a pull request :wink: