rubosquad 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubosquad.rb +9 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1893fc681cd5d1150871642903b53296899cc9524d0a747d0dee72d3e95a388
4
- data.tar.gz: bb45d13fe8ecde3a2a66e9d3e89c3edd1aca115c3d9851b12a48110737630fb6
3
+ metadata.gz: b4122eef7f956af0412b99e4bb2f220ce2afc33a810b77ec2280244eba9e61ec
4
+ data.tar.gz: dd98295ce280108341cfd86deb9f85a97298011517a1879a7a17fc1f8b634470
5
5
  SHA512:
6
- metadata.gz: dcd1d7ac80333b7b0289a248500661b1e929db8eb2b117a0696ae92e147afab5c0f6fb7a4d9311a06de214a70d94c84a4e9a44e4565e30cb277f707043085a63
7
- data.tar.gz: a73bb07f1eb5c63a8da472e6aef8d795fdafaa7da2804abb8bba2338d4bdcdd6080e8b94d69502b392d0f003daae4eb143fcd9ebb9164923265d6acec09077d1
6
+ metadata.gz: c6f8fdca8ada9f7020a7f2544f15ef1c5ec61ba3bc085033b42820c2cba27c1a9c7fa015ca2f8aea156f7e22894542995573155f981757e815ca5fb69b3ed61d
7
+ data.tar.gz: a46e355706bd10b40498712bf2c80f1179e9be08fb804dff81f76391c1a6311092a94325f751fbc6ca7555c9fce78a2167be6ab7e1148714485cc6b3afad07fc
data/lib/rubosquad.rb CHANGED
@@ -132,10 +132,18 @@ module Rubosquad
132
132
  def build_rubocop_cmd(options, extensions, files)
133
133
  flag = options[:unsafe_auto_correct] ? '-A' : '-a'
134
134
  cmd = ['rubocop', flag, '--format', 'offenses', '--format', 'simple']
135
- extensions.each { |ext| cmd.push('--require', ext) }
135
+ load_flag = rubocop_supports_plugin_flag? ? '--plugin' : '--require'
136
+ extensions.each { |ext| cmd.push(load_flag, ext) }
136
137
  cmd.concat(files)
137
138
  end
138
139
 
140
+ def rubocop_supports_plugin_flag?
141
+ spec = Gem::Specification.find_by_name('rubocop')
142
+ spec.version >= Gem::Version.new('1.72.0')
143
+ rescue Gem::LoadError
144
+ false
145
+ end
146
+
139
147
  def format_output(stdout)
140
148
  lines = []
141
149
  seen_files = Set.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubosquad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - LucasWaki