rubosquad 0.4.0 → 0.4.2
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.
- checksums.yaml +4 -4
- data/lib/rubosquad.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77fae3245b3e08691c773b982fa3d52366df1ebf8149ad9aefee6b4cb9251433
|
|
4
|
+
data.tar.gz: 7426d309575c100d0437a866e3c71df9975723827056c35df7bcb93a6458bc4a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c55573f8492aea97c2d37f978c3f3500b9480acbc2582814b94e45ac40958c8792a242934519bbc6f0ea8c618c59b6969dabf810ebbcce9fb2494e7d960b2267
|
|
7
|
+
data.tar.gz: 0d695d1e033226974589a79889755d963dfc3719a3bdc5d70c2410b5142f4be9e3d842111a0aa9a01a87a40094966a248e1db909b2f9de7e28b543755099377c
|
data/lib/rubosquad.rb
CHANGED
|
@@ -123,19 +123,31 @@ module Rubosquad
|
|
|
123
123
|
def detect_extensions
|
|
124
124
|
%w[rubocop-factory_bot rubocop-rails rubocop-rspec rubocop-rspec_rails].select do |ext|
|
|
125
125
|
Gem::Specification.find_by_name(ext)
|
|
126
|
+
require ext
|
|
126
127
|
true
|
|
127
128
|
rescue Gem::LoadError
|
|
128
129
|
false
|
|
130
|
+
rescue LoadError => e
|
|
131
|
+
warn "Warning: #{ext} is installed but could not be loaded (#{e.message}). Skipping."
|
|
132
|
+
false
|
|
129
133
|
end
|
|
130
134
|
end
|
|
131
135
|
|
|
132
136
|
def build_rubocop_cmd(options, extensions, files)
|
|
133
137
|
flag = options[:unsafe_auto_correct] ? '-A' : '-a'
|
|
134
138
|
cmd = ['rubocop', flag, '--format', 'offenses', '--format', 'simple']
|
|
135
|
-
|
|
139
|
+
load_flag = rubocop_supports_plugin_flag? ? '--plugin' : '--require'
|
|
140
|
+
extensions.each { |ext| cmd.push(load_flag, ext) }
|
|
136
141
|
cmd.concat(files)
|
|
137
142
|
end
|
|
138
143
|
|
|
144
|
+
def rubocop_supports_plugin_flag?
|
|
145
|
+
spec = Gem::Specification.find_by_name('rubocop')
|
|
146
|
+
spec.version >= Gem::Version.new('1.72.0')
|
|
147
|
+
rescue Gem::LoadError
|
|
148
|
+
false
|
|
149
|
+
end
|
|
150
|
+
|
|
139
151
|
def format_output(stdout)
|
|
140
152
|
lines = []
|
|
141
153
|
seen_files = Set.new
|