Giter Site home page Giter Site logo

danger-ruby-swiftlint's Introduction

Danger SwiftLint Build Status

A Danger Ruby 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. On CI, this is done for you when the gem is installed.

Usage

The easiest way to use is just add this to your Dangerfile:

swiftlint.lint_files

By default danger-swiftlint will lint added and modified files.

swiftlint.config_file = '.swiftlint.yml'
swiftlint.binary_path = '/path/to/swiftlint'
swiftlint.max_num_violations = 20
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 different configurations on different directories, you can specify the directory. Note: Run swiftlint.lint_files per specified directory then.

swiftlint.directory = "Directory A"

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'

By default, only files that were added or modified are linted.

It's not possible to use nested configurations in that case, 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.

However, you can use the lint_all_files option to lint all the files. In that case, Danger SwiftLint doesn't lint files individually, which makes nested configuration to work. It'd be the same as you were running swiftlint on the root folder:

swiftlint.lint_all_files = true
swiftlint.lint_files

It's also possible to pass a block to filter out any violations after swiftlint has been run. Here's an example filtering out all violations that didn't occur in the current github PR, using the third party gem git_diff_parser:

require 'git_diff_parser'

diff = GitDiffParser::Patches.parse(github.pr_diff)
dir = "#{Dir.pwd}/"
swiftlint.lint_files(inline_mode: true) { |violation|
  diff_filename = violation['file'].gsub(dir, '')
  file_patch = diff.find_patch_by_file(diff_filename)
  file_patch != nil && file_patch.changed_lines.any? { |line| line.number == violation['line']}
}

Or, by passing the no_comment parameter, you can completely manage the commenting of issues, warnings and errors yourself. An example usage might be using GitHub reviews, or custom filtering logic. Note: When this parameter is set to true, all other parameters except files and additional_swiftlint_args are ignored.

swiftlint.lint_files(no_comment: true)

# Now, you can handle the combined warnings + errors, or each separately commenting
swiftlint.issues    # contains combined warnings + errors
swiftlint.warnings  # just warnings
swiftlint.errors    # just errors

You can use the SWIFTLINT_VERSION environment variable to override the default version installed via the rake install task.

Or, if you are behind a proxy or using a package manager which does not allow you to go to github.com directly, you can manually download the SwiftLint package and skip the installation by setting the DANGER_SKIP_SWIFTLINT_INSTALL environment variable equal to YES.

next if ENV['DANGER_SKIP_SWIFTLINT_INSTALL'] == 'YES'

Finally, if something's not working correctly, you can debug this plugin by using setting swiftlint.verbose = true.

Contribution tips

Upgrading Swiftlint to the latest version

Follow this guide -> How-To-Upgrade-Swiftlint

Attribution

Original structure, sequence, and organization of repo taken from danger-prose by David Grandinetti.

License

MIT

danger-ruby-swiftlint's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

danger-ruby-swiftlint's Issues

Arguments vs Properties

Creating this issue after quick discussion on #29

Context

Today we have two different ways to configure swiftlint behaviour 1) Changing its directory property 2) Specifying inline_mode in the lint_files action. Should we unify it?

A more open question would be. Is there a "better/right" way for Danger plugins specify their configuration properties?

The only advantage I can see why use properties is if you have more than one action with shared properties exposed by the plugin. eg:

Dangerfile

#properties
plugin.food = fish
plugin.animal = cat

#actions
plugin.eat_food
plugin.play_with :ball

In this case both food and animal might be relevant to the actions and you only want to set it once

In the case of danger-swiftlint which provides only one action lint-files I think it is more straightforward make everything as arguments, eg:

Dangerfile

Today's world

swiftlint.directory sources
swiftlint.lint_files *.swift, :inline_mode => true

Everything as arguments

swiftlint.lint_files *.swift, :directory => sources, :inline_mode => true

Swiftlint not installed

I followed the instructions on the README, but I'm getting this message:

swiftlint is not in the user's PATH, or it failed to install

I checked Eigen's repo and I couldn't find a place where swiftlint is installed manually. Am I missing a step?

Danger-JS version

I couldn't find anything: is there a Danger-JS version of this plugin? If not I guess I'll switch to using the Ruby version, or is it possible to have 2 Dangerfiles?

danger-swiftlint 0.11 seems to be broken

After updating to danger-swiftlint 0.11 my PRs seem to break with the following error:
2017-11-12 15 54 14

Rolling back to 0.10 resolves the issue so I assume this is a new bug introduced in latest release.

Danger crashes after plugin update

-danger-swiftlint (0.10.1)
+danger-swiftlint (0.12.0)

CI run has failed with the following message:

[!] Invalid Dangerfile file: undefined method positive? for 0:Fixnum

 #  from /tmp/sandbox/workspace/Dangerfile:51
 #  -------------------------------------------
 #  swiftlint.config_file = '.swiftlint.yml'
 >  swiftlint.lint_files inline_mode: true
 #  
 #  -------------------------------------------

CI uses ruby-2.3.1

danger-swxftlint 0.7.0 fails when specifying config file

Very odd, tested 0.6.0 and it works fine.
Although, 0.7.0 works with this configuration:

swiftlint.lint_files

It does fail with this:

swiftlint.config_file = '.swiftlint.yml'
swiftlint.lint_files

The logs report fatal error but it doesn't make CI like travis fail the build and it neither report any type of error whatsoever on the pull request.

fatal error: Could not read configuration file at path '/Users/myuser/Projects/myProject/mySubProject/Sources/Auth0Provider/Authentication/Resources/SignIn.swift/.swiftlint.yml': file /Users/marcelofabri/Westfield/SwiftLint/Source/SwiftLintFramework/Models/Configuration.swift, line 167
/Users/myuser/Projects/myProject/mySubProject/Sources/Auth0Provider/Authentication/Resources/SignIn.swift/.swiftlint.yml:File not found.
fatal error: Could not read configuration file at path '/Users/myuser/Projects/myProject/mySubProject/Sources/AuthenticationProvider/Controllers/AuthenticationController.swift/.swiftlint.yml': file /Users/marcelofabri/Westfield/SwiftLint/Source/SwiftLintFramework/Models/Configuration.swift, line 167
/Users/myuser/Projects/myProject/mySubProject/Sources/AuthenticationProvider/Controllers/AuthenticationController.swift/.swiftlint.yml:File not found.

Errors are weird, not sure what's happening there.
Somehow it seems there is some hardcoded path coming from swiftlint directly.

I am using the latest swiftlint 0.20.1.

Fail gracefully if .swiftlint.yml cannot be parsed

The discussion on #26 showed how at the moment the plugin fails with a quite cryptic error if the given .yml config file is not a valid YAML.

A better behaviour would be to provide the user with an informative message about the state of their file.

Plugin not selectively linting files

Example is here: Moya/Moya#550 (comment) The PR didn't change any library files but all the library files were linted. Three times actually, which is how many Swift files did change. @orta this would explain the duplicate warnings we've seen, since SwiftLint would be run on all files for ever changed Swift file.

Found the cause: realm/SwiftLint#551 . Basically, running swiftlint can either have an included directory in the .yml file or it can have a --path specified from the command line. If both are specified, the --path is ignored. @jpsim has added the "enhancement" tag to the issue, so I'm going to take a crack at it sometime so this plugin works properly.

Invalid `Dangerfile` file: undefined method `map' for nil:NilClass

When parsing a config file that doesn't have any excluded directory, danger-swiftlint crashes.

Adding the following to my config file fixes the issue.

excluded:
  - excluded_dir

Stacktrace:

[!] The exception involves the following plugins:
 -  danger-swiftlint

/Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-swiftlint-0.4.1/lib/danger_plugin.rb:124:in `excluded_files_from_config':  (Danger::DSLError)
[!] Invalid `Dangerfile` file: undefined method `map' for nil:NilClass
Did you mean?  tap
 #  from Dangerfile:22
 #  -------------------------------------------
 #  swiftlint.config_file = ".swiftlint.yml"
 >  swiftlint.lint_files
 #  
 #  -------------------------------------------
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-swiftlint-0.4.1/lib/danger_plugin.rb:42:in `lint_files'
	from Dangerfile:22:in `block in parse'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/danger_core/dangerfile.rb:199:in `eval'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/danger_core/dangerfile.rb:199:in `block in parse'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/danger_core/dangerfile.rb:195:in `instance_eval'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/danger_core/dangerfile.rb:195:in `parse'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/danger_core/dangerfile.rb:272:in `run'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/commands/pr.rb:58:in `block in run'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/commands/local_helpers/local_setup.rb:38:in `setup'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/lib/danger/commands/pr.rb:57:in `run'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/gems/danger-5.0.2/bin/danger:5:in `<top (required)>'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/bin/danger:23:in `load'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/bin/danger:23:in `<main>'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
	from /Users/valerio/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'

[Feature Request] Ability to limit the number of warnings in a PR

PRs from branches that has a large diff could easily trigger hundreds of SwiftLint warnings and errors (hence hundreds of GitHub notification emails). In worst case, GitHub couldn't even load the PR page. It would be great if we could set a maximum number of warnings in a single PR so the PR submitter could focus on fixing one by one.

0.7.0 out?

Hi,

I am getting the following error lately:

 ▸ Error loading the plugin `danger-swiftlint-0.7.0`.
[13:33:33]: ▸ Gem::LoadError - can't activate danger-swiftlint-0.7.0, already activated danger-swiftlint-0.6.0

I guess I need to upgrade my gemfile but I noticed there was no release/tag for 0.7.0, should I restrict it to 0.6.0?

Thanks

Clearer installation instructions

It wasn't clear to me that I needed to install SwiftLint myself outside of the danger and danger-swiftlint setup.

In hindsight this seems obvious. However I wonder if others who are new to Danger (sounds funny) realise they need to do this?

I had the same problem with danger-prose requiring pip to be installed on the machine, which I did not realise.

Would you like a PR for your README.md to add this explanation/description/instructions? 😄

Tests don't run with Rake

Tests don't run in the current repository after running:

bundle exec rake spec

I hope I'm doing it correct.
I edited the Rakefile and it works now.

Update:
Tests do run with

bundle exec rspec spec

Danger release documentation for contributors

We've got a lot of contributors here to help us out improving this repo. As a lack of knowledge, I'm unable to release a new version and I'm wondering if all other contributors have the same.

I'm also not aware if I'm even allowed to release a new version anytime (I would say this is not a problem 💭 )

It would be great if we have a small but clear documentation about releasing new versions to keep a steep release cycle.

Looks like `directory` variable is not escaped

Hello, first of all — thanks for such an awesome tool!

tl;dr: Looks like directory variable used in danger_plugin.rb is not escaped because i have issues when my pwd contains whitespaces

My setup:
Ruby 2.3.3 & rvm 1.28.0
Danger 5.5.3
swiftlint 0.21.0
danger-swiftlint 0.10.0

pwd for my project root folder contains whitespaces (i know it's not a best idea ofc 🙃) and i see next message in logs:
Swiftlint will be run from /Users/austinate/Documents/Projects/somefolder/My Project Name

And when it actually tries to pass argument to swiftlint i see in logs a lot of such messages:
Unrecognized arguments: "My", "Project", "Name/.swiftlint.yml"

I tried to fix this locally and looks like it works fine when i change this line dir_selected = directory ? File.expand_path(directory) : Dir.pwd
to this line:
dir_selected = directory ? File.expand_path(directory) : Shellwords.escape(Dir.pwd)

Can anyone advice if this is a correct fix? i can create a PR with this but wanted to ask first since i'm not that familiar with Ruby and gems.

Fail on error doesn't work as expected.

fail_on_error behavior should be to fail Danger, but instead it crashes danger with a cryptic message.
screen shot 2018-02-21 at 9 15 50 pm

This is due to using raise instead of Danger's fail method.

I came upon this issue when I removed inline_mode from my config.

After checking the history, I came upon this PR which introduced the issue.

I'll be happy to raise a PR to fix this after receiving a 👍

Block PRs for rules with 'severity: error'

We currently use danger-swiftlint @ Slack to check for swift style issues, but we would love to be able to block PRs from being merged until these issues are properly fixed. Is there a way to do that currently with the plugin? If not, any workaround you'd think about? Thanks!

Plugin isn't reporting anything

We're using buddybuild as CI platform and since also have SwiftLint we've decided that Danger with SwiftLint plugin would be a perfect match to give feedback to PR creators.
I wanted to start simple, so at first I've integrated only Danger and things like:

if git.lines_of_code > 500
    warn "Big PR"
end

Worked like a charm! ✨

Then I've added danger-swiftlint to our Gemfile and used the simplest form in our Dangerfile. To my surprise I didn't get any feedback while SwfitLint run directly reports quite some issues.
I've been trying to modify .swift files as well as playing with some options and installation of SwiftLint, but with no luck. TBH, I have no idea where to put my hands now as everything feels pretty much similar to what firefox has.
If you're curious how our implementation looks like, you can take a look at this Pull Request.

Cut a release and publish to rubygems

Once #2 is done and we've run this a bit on eigen, we should cut a release and push to rubygems.org so it's easy to install. Also, update the readme's installation instructions.

Excluded files are being linted

I have a few directories set up to be excluded by SwiftLint in my .swiftlint.yml file. However, if these files change as part of a pull request, they are still linted by this plugin. Is there a way to disable this, or maybe this is a bug? I've been poking around in the readme and past issues, but could not find a mention of something like this. I apologize if I missed it!

I am using version0.12.1 and my Dangerfile is set up like this:

swiftlint.binary_path = 'Pods/SwiftLint/swiftlint'
swiftlint.config_file = '.swiftlint.yml'
swiftlint.lint_files inline_mode: true

Thanks for the help!

SwiftLint 0.26 support

The latest danger-ruby-swiftlint uses SwiftLint v0.25.1.

A new SwiftLint v0.26.0 is now available.

Motivation for the Update

I'm now using Xcode 9.4 and have a PR that danger fails due to this bug realm/SwiftLint#2231. Would like to get my PR merged so need to get this resolved and I'm hoping that with the latest SwiftLint it will go away.

I did try do a workaround by using swiftlint:disable identifier_name but then I get a local Xcode error saying Superfluous Disable Command Violation: SwiftLint rule 'identifier_name' did not trigger a violation in the disabled region. Please remove the disable command. (superfluous_disable_command) so I really need the latest SwiftLint :)

What Next?

Based on previous PRs to this repo, it looks like it's usually just a 1 liner to bump the version as long as there are no breaking changes to the CLI from SwiftLint. Based on the release notes for Swiftlint v0.26.0, the only breaking change is that:

SwiftLint now requires Swift 4.0 or higher to build.

which shouldn't affect danger-ruby-swiftlint right?

I don't mind giving this a shot but not sure what to do. Do I just do something similar to how this PR bumped the version?
https://github.com/ashfurrow/danger-ruby-swiftlint/pull/36/files

danger-swiftlint doesn't warn, while SwiftLint itself does

I'm not sure if this is some misconfiguration (mainly due to the fact there's barely any configuration around danger-swiftlint... )

But when SwiftLint runs by itself, i see specifically

Todo Violation: TODOs should be avoided (...). (todo)

But when danger-swiftlint runs in my CI (Buddybuild), it doesn't warn for some odd reason

Installing danger 5.3.3
Fetching danger-swiftlint 0.7.0
Installing danger-swiftlint 0.7.0 with native extensions
Bundle complete! 2 Gemfile dependencies, 22 gems now installed.
Bundled gems are installed into /tmp/sandbox/workspace/vendor/bundle.

Running Danger
Using Command Line: bundle exec danger --dangerfile=Dangerfile

Results:
    Warnings:
    - [ ] Big PR
    - [ ] The `Podfile` was updated

But no specific warnings related to SwiftLint, and I'm not exactly sure why or if I'm missing something.

Gemfile only has danger and danger-swiftlint

The portion of Dangerfile related to SwiftLint is:

# SwiftLint
swiftlint.config_file = '.swiftlint.yml'
swiftlint.binary_path = './Pods/SwiftLint/swiftlint'
swiftlint.lint_files
swiftlint.lint_files inline_mode: true

I'm wondering if this is related to the fact I'm using a pinned version with CocoaPods, but I don't see why that would be an issue 🤔

Appreciate any help on this :)

Breaks when filename has spaces

e.g.: Observable + Operations.swift breaks the plugin

See here: https://travis-ci.org/RxSwiftCommunity/RxViewModel/builds/142914303

Unrecognized arguments: "Categories/Observable", "+", "Operations.swift" [!] Invalid `Dangerfile` file: A JSON text must at least contain two octets!. Updating the Danger gem might fix the issue. # from Dangerfile:27 # ------------------------------------------- # # Run SwiftLint swiftlint.lint_files # -------------------------------------------

I resorted to renaming the file for now but thought it was a good idea to at least bring this issue to light.

Inline mode doesn't seem to work

It adds the warnings properly in the Danger comment, but doesn't do the "inline" PR feedback. Is there something I'm missing?

## ** SWIFT LINT ***
# Use the SwiftLint included via CocoaPods
swiftlint.binary_path = "#{src_root}/Pods/SwiftLint/swiftlint"
swiftlint.config_file = "#{src_root}/.swiftlint.yml"

# Run Swift-Lint and warn us if anything fails it
swiftlint.directory = src_root
swiftlint.lint_files inline_mode: true
GIT
  remote: https://github.com/Raizlabs/circleci_artifact.git
  revision: bbbf364f084774d77ad37feb21254bbce6befc68
  branch: master
  specs:
    circleci_artifact (0.1.0)
      circleci (~> 2.0)

GIT
  remote: https://github.com/Raizlabs/xcov.git
  revision: 41e7d39f97a1665b3048d9035547b025caf9ff91
  branch: 1.4.0-rz
  specs:
    xcov (1.4.0)
      fastlane (>= 2.82.0, < 3.0.0)
      multipart-post
      slack-notifier
      terminal-table
      xcodeproj

GIT
  remote: https://github.com/arrouse/install_provisioning_profiles
  revision: 4cd48378552db10f3872b5bb591cf219d30fb580
  specs:
    fastlane-plugin-install_provisioning_profiles (0.2.1)

GEM
  remote: https://rubygems.org/
  specs:
    CFPropertyList (2.3.6)
    activesupport (4.2.10)
      i18n (~> 0.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.5.2)
      public_suffix (>= 2.0.2, < 4.0)
    atomos (0.1.2)
    babosa (1.0.2)
    circleci (2.0.2)
    claide (1.0.2)
    claide-plugins (0.9.2)
      cork
      nap
      open4 (~> 1.3)
    clamp (0.6.5)
    cocoapods (1.5.0)
      activesupport (>= 4.0.2, < 5)
      claide (>= 1.0.2, < 2.0)
      cocoapods-core (= 1.5.0)
      cocoapods-deintegrate (>= 1.0.2, < 2.0)
      cocoapods-downloader (>= 1.2.0, < 2.0)
      cocoapods-plugins (>= 1.0.0, < 2.0)
      cocoapods-search (>= 1.0.0, < 2.0)
      cocoapods-stats (>= 1.0.0, < 2.0)
      cocoapods-trunk (>= 1.3.0, < 2.0)
      cocoapods-try (>= 1.1.0, < 2.0)
      colored2 (~> 3.1)
      escape (~> 0.0.4)
      fourflusher (~> 2.0.1)
      gh_inspector (~> 1.0)
      molinillo (~> 0.6.5)
      nap (~> 1.0)
      ruby-macho (~> 1.1)
      xcodeproj (>= 1.5.7, < 2.0)
    cocoapods-core (1.5.0)
      activesupport (>= 4.0.2, < 6)
      fuzzy_match (~> 2.0.4)
      nap (~> 1.0)
    cocoapods-deintegrate (1.0.2)
    cocoapods-downloader (1.2.0)
    cocoapods-plugins (1.0.0)
      nap
    cocoapods-search (1.0.0)
    cocoapods-stats (1.0.0)
    cocoapods-trunk (1.3.0)
      nap (>= 0.8, < 2.0)
      netrc (~> 0.11)
    cocoapods-try (1.1.0)
    colored (1.2)
    colored2 (3.1.2)
    colorize (0.8.1)
    commander-fastlane (4.4.6)
      highline (~> 1.7.2)
    concurrent-ruby (1.0.5)
    cork (0.3.0)
      colored2 (~> 3.1)
    danger (5.5.12)
      claide (~> 1.0)
      claide-plugins (>= 0.9.2)
      colored2 (~> 3.1)
      cork (~> 0.1)
      faraday (~> 0.9)
      faraday-http-cache (~> 1.0)
      git (~> 1)
      kramdown (~> 1.5)
      no_proxy_fix
      octokit (~> 4.7)
      terminal-table (~> 1)
    danger-junit (0.7.4)
      danger (> 2.0)
      ox (~> 2.0)
    danger-swiftlint (0.16.0)
      danger
      rake (> 10)
      thor (~> 0.19)
    danger-xcov (0.4.1)
      danger (>= 2.1)
      xcov (>= 1.1.2)
    declarative (0.0.10)
    declarative-option (0.1.0)
    domain_name (0.5.20170404)
      unf (>= 0.0.5, < 1.0.0)
    dotenv (2.2.2)
    emoji_regex (0.1.1)
    escape (0.0.4)
    excon (0.62.0)
    faraday (0.14.0)
      multipart-post (>= 1.2, < 3)
    faraday-cookie_jar (0.0.6)
      faraday (>= 0.7.4)
      http-cookie (~> 1.0.0)
    faraday-http-cache (1.3.1)
      faraday (~> 0.8)
    faraday_middleware (0.12.2)
      faraday (>= 0.7.4, < 1.0)
    fastimage (2.1.1)
    fastlane (2.92.1)
      CFPropertyList (>= 2.3, < 4.0.0)
      addressable (>= 2.3, < 3.0.0)
      babosa (>= 1.0.2, < 2.0.0)
      bundler (>= 1.12.0, < 2.0.0)
      colored
      commander-fastlane (>= 4.4.6, < 5.0.0)
      dotenv (>= 2.1.1, < 3.0.0)
      emoji_regex (~> 0.1)
      excon (>= 0.45.0, < 1.0.0)
      faraday (~> 0.9)
      faraday-cookie_jar (~> 0.0.6)
      faraday_middleware (~> 0.9)
      fastimage (>= 2.1.0, < 3.0.0)
      gh_inspector (>= 1.1.2, < 2.0.0)
      google-api-client (>= 0.13.1, < 0.14.0)
      highline (>= 1.7.2, < 2.0.0)
      json (< 3.0.0)
      mini_magick (~> 4.5.1)
      multi_json
      multi_xml (~> 0.5)
      multipart-post (~> 2.0.0)
      plist (>= 3.1.0, < 4.0.0)
      public_suffix (~> 2.0.0)
      rubyzip (>= 1.1.0, < 2.0.0)
      security (= 0.1.3)
      simctl (~> 1.6.3)
      slack-notifier (>= 2.0.0, < 3.0.0)
      terminal-notifier (>= 1.6.2, < 2.0.0)
      terminal-table (>= 1.4.5, < 2.0.0)
      tty-screen (>= 0.6.3, < 1.0.0)
      tty-spinner (>= 0.8.0, < 1.0.0)
      word_wrap (~> 1.0.0)
      xcodeproj (>= 1.5.7, < 2.0.0)
      xcpretty (>= 0.2.4, < 1.0.0)
      xcpretty-travis-formatter (>= 0.0.3)
    fourflusher (2.0.1)
    fuzzy_match (2.0.4)
    gh_inspector (1.1.3)
    git (1.3.0)
    google-api-client (0.13.6)
      addressable (~> 2.5, >= 2.5.1)
      googleauth (~> 0.5)
      httpclient (>= 2.8.1, < 3.0)
      mime-types (~> 3.0)
      representable (~> 3.0)
      retriable (>= 2.0, < 4.0)
    googleauth (0.6.2)
      faraday (~> 0.12)
      jwt (>= 1.4, < 3.0)
      logging (~> 2.0)
      memoist (~> 0.12)
      multi_json (~> 1.11)
      os (~> 0.9)
      signet (~> 0.7)
    highline (1.7.10)
    http-cookie (1.0.3)
      domain_name (~> 0.5)
    httpclient (2.8.3)
    i18n (0.9.5)
      concurrent-ruby (~> 1.0)
    json (2.1.0)
    jwt (2.1.0)
    kramdown (1.16.2)
    little-plugger (1.1.4)
    logging (2.2.2)
      little-plugger (~> 1.1)
      multi_json (~> 1.10)
    memoist (0.16.0)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_magick (4.5.1)
    mini_portile2 (2.3.0)
    minitest (5.11.3)
    molinillo (0.6.5)
    multi_json (1.13.1)
    multi_xml (0.6.0)
    multipart-post (2.0.0)
    nanaimo (0.2.5)
    nap (1.1.0)
    naturally (2.1.0)
    netrc (0.11.0)
    no_proxy_fix (0.1.2)
    nokogiri (1.8.2)
      mini_portile2 (~> 2.3.0)
    octokit (4.8.0)
      sawyer (~> 0.8.0, >= 0.5.3)
    open4 (1.3.4)
    os (0.9.6)
    ox (2.9.2)
    plist (3.4.0)
    public_suffix (2.0.5)
    rake (12.3.1)
    representable (3.0.4)
      declarative (< 0.1.0)
      declarative-option (< 0.2.0)
      uber (< 0.2.0)
    retriable (3.1.1)
    rouge (2.0.7)
    ruby-macho (1.1.0)
    rubyzip (1.2.1)
    sawyer (0.8.1)
      addressable (>= 2.3.5, < 2.6)
      faraday (~> 0.8, < 1.0)
    security (0.1.3)
    signet (0.8.1)
      addressable (~> 2.3)
      faraday (~> 0.9)
      jwt (>= 1.5, < 3.0)
      multi_json (~> 1.10)
    simctl (1.6.4)
      CFPropertyList
      naturally
    slack-notifier (2.3.2)
    slather (2.4.5)
      CFPropertyList (~> 2.2)
      activesupport (>= 4.0.2)
      clamp (~> 0.6)
      nokogiri (~> 1.8.2)
      xcodeproj (~> 1.4)
    synx (0.2.1)
      clamp (~> 0.6)
      colorize (~> 0.7)
      xcodeproj (~> 1.0)
    terminal-notifier (1.8.0)
    terminal-table (1.8.0)
      unicode-display_width (~> 1.1, >= 1.1.1)
    thor (0.20.0)
    thread_safe (0.3.6)
    tty-cursor (0.5.0)
    tty-screen (0.6.4)
    tty-spinner (0.8.0)
      tty-cursor (>= 0.5.0)
    tzinfo (1.2.5)
      thread_safe (~> 0.1)
    uber (0.1.0)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.5)
    unicode-display_width (1.3.0)
    word_wrap (1.0.0)
    xcodeproj (1.5.7)
      CFPropertyList (>= 2.3.3, < 4.0)
      atomos (~> 0.1.2)
      claide (>= 1.0.2, < 2.0)
      colored2 (~> 3.1)
      nanaimo (~> 0.2.4)
    xcpretty (0.2.8)
      rouge (~> 2.0.7)
    xcpretty-travis-formatter (1.0.0)
      xcpretty (~> 0.2, >= 0.0.7)

PLATFORMS
  ruby

DEPENDENCIES
  circleci_artifact!
  cocoapods
  danger
  danger-junit
  danger-swiftlint
  danger-xcov
  fastlane
  fastlane-plugin-install_provisioning_profiles!
  nanaimo
  slather
  synx
  xcov!

BUNDLED WITH
   1.16.1
PODS:
  - Alamofire (4.7.1)
  - Anchorage (4.2.2)
  - BonMot (5.2)
  - Crashlytics (3.10.1):
    - Fabric (~> 1.7.5)
  - Fabric (1.7.6)
  - GoogleAnalytics (3.17.0)
  - Instabug (7.11.2):
    - Instabug/Instabug (= 7.11.2)
    - Instabug/InstabugCore (= 7.11.2)
  - Instabug/Instabug (7.11.2):
    - Instabug/InstabugCore
  - Instabug/InstabugCore (7.11.2)
  - KeychainAccess (3.1.0)
  - Marshal (1.2.4)
  - OHHTTPStubs/Core (6.1.0)
  - OHHTTPStubs/Default (6.1.0):
    - OHHTTPStubs/Core
    - OHHTTPStubs/JSON
    - OHHTTPStubs/NSURLSession
    - OHHTTPStubs/OHPathHelpers
  - OHHTTPStubs/JSON (6.1.0):
    - OHHTTPStubs/Core
  - OHHTTPStubs/NSURLSession (6.1.0):
    - OHHTTPStubs/Core
  - OHHTTPStubs/OHPathHelpers (6.1.0)
  - OHHTTPStubs/Swift (6.1.0):
    - OHHTTPStubs/Default
  - SimulatorStatusMagic (2.1)
  - Sourcery (0.12.0)
  - SwiftGen (5.3.0)
  - Swiftilities (0.17.0):
    - Swiftilities/All (= 0.17.0)
  - Swiftilities/AboutView (0.17.0)
  - Swiftilities/AccessibilityHelpers (0.17.0)
  - Swiftilities/Acknowledgements (0.17.0):
    - Swiftilities/Deselection
    - Swiftilities/LicenseFormatter
  - Swiftilities/All (0.17.0):
    - Swiftilities/AboutView
    - Swiftilities/AccessibilityHelpers
    - Swiftilities/Acknowledgements
    - Swiftilities/BetterButton
    - Swiftilities/ColorHelpers
    - Swiftilities/CoreDataStack
    - Swiftilities/Deselection
    - Swiftilities/DeviceSize
    - Swiftilities/FormattedTextField
    - Swiftilities/Forms
    - Swiftilities/HairlineView
    - Swiftilities/ImageHelpers
    - Swiftilities/Keyboard
    - Swiftilities/LicenseFormatter
    - Swiftilities/Lifecycle
    - Swiftilities/Logging
    - Swiftilities/Math
    - Swiftilities/RootViewController
    - Swiftilities/Shapes
    - Swiftilities/StackViewHelpers
    - Swiftilities/TableViewHelpers
    - Swiftilities/TintedButton
    - Swiftilities/Views
  - Swiftilities/BetterButton (0.17.0):
    - Swiftilities/ColorHelpers
    - Swiftilities/ImageHelpers
    - Swiftilities/Math
    - Swiftilities/Shapes
  - Swiftilities/ColorHelpers (0.17.0)
  - Swiftilities/CoreDataStack (0.17.0)
  - Swiftilities/Deselection (0.17.0)
  - Swiftilities/DeviceSize (0.17.0)
  - Swiftilities/FormattedTextField (0.17.0)
  - Swiftilities/Forms (0.17.0)
  - Swiftilities/HairlineView (0.17.0)
  - Swiftilities/ImageHelpers (0.17.0)
  - Swiftilities/Keyboard (0.17.0)
  - Swiftilities/LicenseFormatter (0.17.0)
  - Swiftilities/Lifecycle (0.17.0):
    - Swiftilities/HairlineView
    - Swiftilities/Math
  - Swiftilities/Logging (0.17.0)
  - Swiftilities/Math (0.17.0)
  - Swiftilities/RootViewController (0.17.0)
  - Swiftilities/Shapes (0.17.0)
  - Swiftilities/StackViewHelpers (0.17.0)
  - Swiftilities/TableViewHelpers (0.17.0)
  - Swiftilities/TintedButton (0.17.0)
  - Swiftilities/Views (0.17.0)
  - SwiftLint (0.25.0)

DEPENDENCIES:
  - Alamofire
  - Anchorage
  - BonMot
  - Crashlytics
  - GoogleAnalytics (~> 3.0)
  - Instabug
  - KeychainAccess
  - Marshal
  - OHHTTPStubs/Swift
  - SimulatorStatusMagic
  - Sourcery (~> 0.12.0)
  - SwiftGen
  - Swiftilities
  - SwiftLint

SPEC REPOS:
  https://github.com/CocoaPods/Specs.git:
    - Alamofire
    - Anchorage
    - BonMot
    - Crashlytics
    - Fabric
    - GoogleAnalytics
    - Instabug
    - KeychainAccess
    - Marshal
    - OHHTTPStubs
    - SimulatorStatusMagic
    - Sourcery
    - SwiftGen
    - Swiftilities
    - SwiftLint

SPEC CHECKSUMS:
  Alamofire: 68d7d521118d49c615a8d2214d87cdf525599d30
  Anchorage: cba8707ea6475f604e04047882ba47c07e4b2ac1
  BonMot: 68da0bd7c2f602aca85511bedabd211eb0fae666
  Crashlytics: aee1a064cbbf99b32efa3f056a5f458d846bc8ff
  Fabric: f8d42c893bb187326a7968b62abe55c36a987a46
  GoogleAnalytics: f42cc53a87a51fe94334821868d9c8481ff47a7b
  Instabug: 3544cf0d0481af01f659ae50dbe426e5d86c5479
  KeychainAccess: 94c5540b32eabf7bc32bfb976a268e8ea05fd6da
  Marshal: 8e04e6624e506921db7143b0bfd83caee03f32d6
  OHHTTPStubs: 1e21c7d2c084b8153fc53d48400d8919d2d432d0
  SimulatorStatusMagic: 481558caf2b9ccb2ceba2cc193728d4db3dcac07
  Sourcery: 10fa92cd8890864856ee3657ca460d597ebc064b
  SwiftGen: 4379bd3640b0a212a0f6ea3c494adba385513d10
  Swiftilities: 38a1e58d290e1a70f3ad345ccb2e2e0556375540
  SwiftLint: e14651157288e9e01d6e1a71db7014fb5744a8ea

PODFILE CHECKSUM: 575f8d011131dc7a1e7a95dc9005ab3705198362

COCOAPODS: 1.5.0

[Feature Request] Fail on warnings

There's a nice switch for failing the build on a linter error. We would love to fail on any warnings in the PR only. Setting warning_threshold: 0 in swiftlint itself limits is a bit too draconian for running CI test and development.

In other words, how bout a fail_on_warning: true ¯\_(ツ)_/¯

Checking for interest. I can make a PR if it sounds like a good idea.

[Bug] Invalid path for moved / renamed files

I am not sure if it's a problem in danger or the plugin.

When a file get moved from a directory to another one, I guess GitHub sent something like this to the modified files, that causes the following error, because obviously that's not a valid path.

No lintable files found at path 'myProjectTests/{ => Views}/MyViewTests.swift'

To reproduce it, move a file so that GitHub generates something like this in the diff:
screen shot 2016-07-27 at 23 58 48

Danger-Swiftlint (0.9) isn't working with Danger (5.4.1)

Running swiftlint locally runs fine and generates expected output. However, running bundle exec danger local with swiftlint.lint_files has no output from swiftlint, just the danger commands.

Danger - 5.4.1
Danger-swiftlint - 0.9
Swiftlint - 0.22.0

Configuration error

Probably caused by this commit, we're now getting errors in our setup:

fatal error: Could not read configuration file at path '/Users/antoinevanderlee/Documents/GIT-Projects/WeTransfer/Coyote/Coyote/Views/Bucket/BucketViewController.swift/Submodules/Rabbit/.swiftlint.yml': file /Users/marcelofabri/Westfield/SwiftLint/Source/SwiftLintFramework/Models/Configuration.swift, line 167

It seems to be expecting a config file for each file specific, where we used the config_file to reuse a config file from our submodule.

What is the reason for this change @ashfurrow? Any new changes on how to use the config file path now?

Update
I can verify our setup is working with the 0.9.0 release from before. Our config:

# Run SwiftLint
swiftlint.config_file = "Submodules/Rabbit/.swiftlint.yml"
swiftlint.lint_files inline_mode: true

Lint

Should try linting the plugin.

Switch to different folder path

Is there a way to switch to different folder path and then run swiftlint in Dangerfile and then switch back to the main folder?

For e.g.

Folder A
---- Folder B
---- Folder C

My main folder is Folder A. I want to switch to Folder B and then run swiftlint in it. My .swiftlint.yml file is inside Folder B. After swiftlint is complete, I want to switch back to Folder A.

Error: Failed to build gem native extension

Since https://github.com/ashfurrow/danger-swiftlint/pull/55 got merged and new versions have been release, we haven't been able to upgrade. Whatever new version of danger-swiftlint is released, we keep getting a Gem::Ext::BuildError: ERROR: Failed to build gem native extension. on the CI.

Any version after 0.8.0 is failing for us.

Any help would be greatly appreciated!

This is my Gemfile:

source "https://rubygems.org"

gem 'danger', '~> 5.2'
gem 'danger-swiftlint', '~> 0.10'
gem 'danger-xcov', '~> 0.3.3'
gem 'xcov', '~> 1.3.0'

And the CI logs (buddybuild):

=== Danger! ===

Installing bundler

Using Command Line: gem install "bundler" --no-rdoc --no-ri

Successfully installed bundler-1.16.0

1 gem installed

Installing Danger

Using Command Line: bundle install

Fetching gem metadata from https://rubygems.org/........

Fetching rake 12.2.1

Installing rake 12.2.1

Fetching CFPropertyList 2.3.5

Installing CFPropertyList 2.3.5

Fetching public_suffix 2.0.5

Installing public_suffix 2.0.5

Fetching addressable 2.5.1

Installing addressable 2.5.1

Fetching babosa 1.0.2

Installing babosa 1.0.2

Using bundler 1.16.0

Fetching claide 1.0.2

Installing claide 1.0.2

Fetching colored2 3.1.2

Installing colored2 3.1.2

Fetching cork 0.3.0

Installing cork 0.3.0

Fetching nap 1.1.0

Installing nap 1.1.0

Fetching open4 1.3.4

Installing open4 1.3.4

Fetching claide-plugins 0.9.2

Installing claide-plugins 0.9.2

Fetching colored 1.2

Installing colored 1.2

Fetching highline 1.7.8

Installing highline 1.7.8

Fetching commander-fastlane 4.4.5

Installing commander-fastlane 4.4.5

Fetching multipart-post 2.0.0

Installing multipart-post 2.0.0

Fetching faraday 0.12.2

Installing faraday 0.12.2

Fetching faraday-http-cache 1.3.1

Installing faraday-http-cache 1.3.1

Fetching git 1.3.0

Installing git 1.3.0

Fetching kramdown 1.14.0

Installing kramdown 1.14.0

Fetching sawyer 0.8.1

Installing sawyer 0.8.1

Fetching octokit 4.7.0

Installing octokit 4.7.0

Fetching unicode-display_width 1.3.0

Installing unicode-display_width 1.3.0

Fetching terminal-table 1.8.0

Installing terminal-table 1.8.0

Fetching danger 5.3.4

Installing danger 5.3.4

Fetching thor 0.20.0

Installing thor 0.20.0

Fetching danger-swiftlint 0.11.0

Installing danger-swiftlint 0.11.0 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/buddybuild/.rubies/ruby-2.2.5/bin/ruby -rubygems

/tmp/sandbox/workspace/vendor/bundle/ruby/2.2.0/gems/rake-12.2.1/exe/rake

RUBYARCHDIR=/tmp/sandbox/workspace/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-16/2.2.0-static/danger-swiftlint-0.11.0

RUBYLIBDIR=/tmp/sandbox/workspace/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-16/2.2.0-static/danger-swiftlint-0.11.0

mkdir -p

/private/tmp/sandbox/workspace/vendor/bundle/ruby/2.2.0/gems/danger-swiftlint-0.11.0/ext/swiftlint/bin

&& curl -s -L

https://github.com/realm/SwiftLint/releases/download/<SWIFTLINT_VERSION redacted>/portable_swiftlint.zip

-o portable_swiftlint.zip && unzip -q portable_swiftlint.zip -d

/private/tmp/sandbox/workspace/vendor/bundle/ruby/2.2.0/gems/danger-swiftlint-0.11.0/ext/swiftlint/bin

&& rm portable_swiftlint.zip

Downloading swiftlint@<SWIFTLINT_VERSION redacted>

[portable_swiftlint.zip]

  End-of-central-directory signature not found.  Either this file is not

  a zipfile, or it constitutes one disk of a multi-part archive.  In the

  latter case the central directory and zipfile comment will be found on

  the last disk(s) of this archive.

unzip:  cannot find zipfile directory in one of portable_swiftlint.zip or

portable_swiftlint.zip.zip, and cannot find portable_swiftlint.zip.ZIP,

period.

rake aborted!

Command failed with status (9): [mkdir -p /private/tmp/sandbox/workspace/ve...]

/private/tmp/sandbox/workspace/vendor/bundle/ruby/2.2.0/gems/danger-swiftlint-0.11.0/ext/swiftlint/Rakefile:15:in

`block (2 levels) in <top (required)>'

/tmp/sandbox/workspace/vendor/bundle/ruby/2.2.0/gems/rake-12.2.1/exe/rake:27:in

`<main>'

Tasks: TOP => default => swiftlint:install

(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in

/tmp/sandbox/workspace/vendor/bundle/ruby/2.2.0/gems/danger-swiftlint-0.11.0 for

inspection.

Results logged to

/tmp/sandbox/workspace/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-16/2.2.0-static/danger-swiftlint-0.11.0/gem_make.out

An error occurred while installing danger-swiftlint (0.11.0), and Bundler cannot

continue.

Make sure that `gem install danger-swiftlint -v '0.11.0'` succeeds before

bundling.

In Gemfile:

  danger-swiftlint

Skipping Danger - encountered bundler errors

Evaluate if an update of selective linting implementation is needed

Now that the issue in the SwiftLint behaviour that was preventing a "direct" implementation of selective linting has been fixed we should re-evaluate way selective linting is implemented.

My guess is that we won't need to generate a dedicated config file on the fly anymore, which should simplify the code a bit. Win!

It could also be an interesting occasion to setup some testing on actual macOS boxes running SwiftLint, to ensure we're actually in line with its behaviour.

Integration Test

Need tot ry actually using this on eigen to make sure there're no gotchas.

v0.3.0 failing: Invalid `Dangerfile` file: (./.swiftlint.yml)

I'm getting errors when using danger-swiftlint both locally (osx) and on Circle CI (also osx), since upgrading to 0.3.0. swiftlint works fine run by itself, and downgrading back to 0.2.1 fixes the problem.

Output from bundle exec danger local:

Running your Dangerfile against this PR - https://github.com/XXX/XXX/pull/129
Turning on --verbose

Info:
... (removed to keep this short, let me know if it might be relevant)

[!] The exception involves the following plugins:
 -  danger-swiftlint

bundler: failed to load command: danger (/usr/local/bin/danger)
Danger::DSLError: 
[!] Invalid `Dangerfile` file: (./.swiftlint.yml): did not find expected key while parsing a block mapping at line 3 column 1
 #  from Dangerfile:2
 #  -------------------------------------------
 #  swiftlint.config_file = "./.swiftlint.yml"
 >  swiftlint.lint_files
 #  
 #  -------------------------------------------

  /usr/local/Cellar/ruby/2.3.1_2/lib/ruby/2.3.0/psych.rb:377:in `parse'
  /usr/local/Cellar/ruby/2.3.1_2/lib/ruby/2.3.0/psych.rb:377:in `parse_stream'
  /usr/local/Cellar/ruby/2.3.1_2/lib/ruby/2.3.0/psych.rb:325:in `parse'
  /usr/local/Cellar/ruby/2.3.1_2/lib/ruby/2.3.0/psych.rb:252:in `load'
  /usr/local/Cellar/ruby/2.3.1_2/lib/ruby/2.3.0/psych.rb:471:in `block in load_file'
  /usr/local/Cellar/ruby/2.3.1_2/lib/ruby/2.3.0/psych.rb:471:in `open'
  /usr/local/Cellar/ruby/2.3.1_2/lib/ruby/2.3.0/psych.rb:471:in `load_file'
  /usr/local/lib/ruby/gems/2.3.0/gems/danger-swiftlint-0.3.0/lib/danger_plugin.rb:48:in `block in lint_files'
  /usr/local/Cellar/ruby/2.3.1_2/lib/ruby/2.3.0/tempfile.rb:295:in `open'
  /usr/local/lib/ruby/gems/2.3.0/gems/danger-swiftlint-0.3.0/lib/danger_plugin.rb:43:in `lint_files'
  Dangerfile:2:in `block in parse'
  /usr/local/lib/ruby/gems/2.3.0/gems/danger-4.1.1/lib/danger/danger_core/dangerfile.rb:199:in `eval'
  /usr/local/lib/ruby/gems/2.3.0/gems/danger-4.1.1/lib/danger/danger_core/dangerfile.rb:199:in `block in parse'
  /usr/local/lib/ruby/gems/2.3.0/gems/danger-4.1.1/lib/danger/danger_core/dangerfile.rb:195:in `instance_eval'
  /usr/local/lib/ruby/gems/2.3.0/gems/danger-4.1.1/lib/danger/danger_core/dangerfile.rb:195:in `parse'
  /usr/local/lib/ruby/gems/2.3.0/gems/danger-4.1.1/lib/danger/commands/local.rb:109:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
  /usr/local/lib/ruby/gems/2.3.0/gems/danger-4.1.1/bin/danger:5:in `<top (required)>'
  /usr/local/bin/danger:22:in `load'
  /usr/local/bin/danger:22:in `<top (required)>'

.swiftlint.yml:

# custom linter rules defined and tested at https://github.com/XXX/XXX

excluded:
  - Carthage
  - Pods

line_length:
  - 210
  - 220

type_name:
  min_length: 2
  max_length:
    - 60
    - 80

variable_name:
  min_length: 1
  max_length:
    - 60
    - 80

large_tuple:
  - 4

function_parameter_count:
  - 6

disabled_rules:
  - trailing_whitespace #this should stay disabled
  - todo #should stay disabled
  - nesting #should stay disabled
  - opening_brace #keep disabled, but enabled and run autocorrect every now and then
  - closing_brace #keep disabled, but enabled and run autocorrect every now and then
  - force_try
  - force_cast
  - type_body_length
  - function_body_length
  - file_length
  - vertical_parameter_alignment
  - redundant_optional_initialization
  - redundant_string_enum_value
  - trailing_newline #for now
  - vertical_whitespace #for now
  - line_length #for now
  - comma #for now
  - trailing_comma #for now
  - colon #for now
  - operator_whitespace #for now
  - nimble_operator #for now
  - statement_position #for now
  - variable_name #for now
  - implicit_getter #for now
  - syntactic_sugar #for now
  - control_statement #for now
  - unused_closure_parameter #for now
  - mark #for now
  - weak_delegate #for now
  - cyclomatic_complexity #for now
  - explicit_init #for now
  - overridden_super_call #for now

 opt_in_rules:
  - overridden_super_call
  - redundant_nil_coalesing
  - explicit_init
  - nimble_operator

custom_rules:
  localized_string:
    name: "Localized String Dynamic Key"
    regex: 'NSLocalizedString'
    message: "User facing strings don't belong in the network SDK!"
    severity: error
  nscoding:
    name: "NSCoding"
    regex: '(\bNSCoding\b|\bNSCoder\b|\bNSSecureCoding\b|\bclassForCoder\b|\bsupportsSecureCoding\b)'
    message: "Don\'t use NSCoding\/NSSecureCoding"
    severity: error
#  nested_guard:
#    name: "Nested Guard"
#    regex: '(?:\bif\b|\bswitch\b|\bfor\b)[^\{\n:]*\{[^\}]*[^\}]*^\s*(guard).*$'
#    message: "guard may not be nested inside other control flow statements (see Domain SE-0010)"
#    severity: warning
  unique_error_domain:
    name: "Unique Error Domain"
    regex: 'DomainExceptionLogging\.(?:\w+WithMessage\(|.*domain: )(?:(\"[^\"\n]*\\\([^\)\n]+\)[^\"\n]*\")|([^\"\n]+)[\,\)])'
    message: "Error domains should be general and non-unique, to facilitate error grouping"
    severity: warning

Reorder README examples

The examples for the for inline_mode and specifying a directory should be switched.

Current README

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.directory "Directory A"

If you want different configurations on different directories, you can specify the directory. Note: Run swiftlint.lint_files per specified directory then.

swiftlint.lint_files inline_mode: true

inline_mode doesn't work with fail_on_error

Add the following line in your Dangerfile

swiftlint.lint_files inline_mode: true, fail_on_error: false

Now introduce lint errors in your code.

Danger will fail regardless of the value of fail_on_error displaying the lint errors in the PR.
The culprit is this line.

I don't know if this is the intended behavior or not.
Either the bug should be fixed or the README should be updated to highlight this fact.

Will be happy to raise a PR in either case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.