Danger SwiftLint
A Danger plugin for SwiftLint that runs on macOS.
Installation
Add this line to your Gemfile:
gem 'danger-swiftlint'
SwiftLint also needs to be installed before you run Danger, which you can do via Homebrew or a Brewfile.
Usage
The easiest way to use is just add this to your Dangerfile:
swiftlint.lint_files
That's going to lint all your Swift files. It would be better to only lint the changed or added ones, which is complicated due. Check out this issue for more details.
swiftlint.config_file = '.swiftlint.yml'
swiftlint.binary_path = '/path/to/swiftlint'
swiftlint.lint_files
If you want the lint result shows in diff instead of comment, you can use inline_mode option. Violations that out of the diff will show in danger's fail or warn section.
swiftlint.lint_files inline_mode: true
If you want lint errors to fail Danger, you can use fail_on_error option.
swiftlint.lint_files fail_on_error: true
If you need to specify options for swiftlint that can only be specified by command line arguments, use the additional_swiftlint_args option.
swiftlint.lint_files additional_swiftlint_args: '--lenient'
You can use the SWIFTLINT_VERSION environment variable to override the default version installed via the rake install task.
Finally, if something's not working correctly, you can debug this plugin by using setting swiftlint.verbose = true.
Attribution
Original structure, sequence, and organization of repo taken from danger-prose by David Grandinetti.
License
MIT