ashfurrow / danger-ruby-swiftlint

A Danger plugin for SwiftLint.
https://rubygems.org/gems/danger-swiftlint
MIT License
203 stars 81 forks source link

Add basic Rubocop support #61

Closed mokagio closed 7 years ago

mokagio commented 7 years ago

This PR addresses #1, by installing Rubocop, running it with --auto-fix, and fixing all the remaining offences that were straightforward.

Since in #1 no particular style was mentioned, I think we should just go with whichever defaults the Rubocop style guide suggests.

The only exceptions I took the liberty of making have been:

Things still to do:

For the record, here's the remaining offences:

Inspecting 12 files
......CC.C..

Offenses:

ext/swiftlint/swiftlint.rb:15:81: C: Line is too long. [89/80]
    `#{swiftlint_path} #{cmd} #{swiftlint_arguments(options, additional_swiftlint_args)}`
                                                                                ^^^^^^^^^
ext/swiftlint/swiftlint.rb:38:3: C: Assignment Branch Condition size for swiftlint_arguments is too high. [15.13/15]
  def swiftlint_arguments(options, additional_swiftlint_args)
  ^^^
ext/swiftlint/swiftlint.rb:45:81: C: Line is too long. [86/80]
      map { |key, value| value.is_a?(FalseClass) ? ["no-#{key}", ''] : [key, value] }.
                                                                                ^^^^^^
lib/danger_plugin.rb:22:3: C: Class has too many lines. [107/100]
  class DangerSwiftlint < Plugin ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/danger_plugin.rb:45:5: C: Assignment Branch Condition size for lint_files is too high. [46.24/15]
    def lint_files(files = nil, inline_mode: false, fail_on_error: false, additional_swiftlint_args: '')
    ^^^
lib/danger_plugin.rb:45:5: C: Cyclomatic complexity for lint_files is too high. [12/6]
    def lint_files(files = nil, inline_mode: false, fail_on_error: false, additional_swiftlint_args: '')
    ^^^
lib/danger_plugin.rb:45:5: C: Method has too many lines. [35/10]
    def lint_files(files = nil, inline_mode: false, fail_on_error: false, additional_swiftlint_args: '') ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/danger_plugin.rb:45:5: C: Perceived complexity for lint_files is too high. [14/7]
    def lint_files(files = nil, inline_mode: false, fail_on_error: false, additional_swiftlint_args: '')
    ^^^
lib/danger_plugin.rb:45:81: C: Line is too long. [104/80]
    def lint_files(files = nil, inline_mode: false, fail_on_error: false, additional_swiftlint_args: '')
                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^
lib/danger_plugin.rb:107:81: C: Line is too long. [87/80]
        .map { |full_options| swiftlint.lint(full_options, additional_swiftlint_args) }
                                                                                ^^^^^^^
lib/danger_plugin.rb:117:5: C: Assignment Branch Condition size for find_swift_files is too high. [25.04/15]
    def find_swift_files(dir_selected, files = nil, excluded_paths = [])
    ^^^
lib/danger_plugin.rb:117:5: C: Method has too many lines. [18/10]
    def find_swift_files(dir_selected, files = nil, excluded_paths = []) ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/danger_plugin_spec.rb:5:1: C: Module has too many lines. [173/100]
module Danger ...
^^^^^^^^^^^^^

12 files inspected, 13 offenses detected
ashfurrow commented 7 years ago

Excellent, so that works 👍

Edit: screencap for when Danger deletes the comment:

screen shot 2017-10-09 at 5 42 21 pm

mokagio commented 7 years ago

🎉 🚀 🤖 thanks @ashfurrow!

ashfurrow commented 7 years ago

No problem, thanks for taking this on! 🌟