yast-rake 0.2.43 → 0.2.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/tasks/rubocop.rake +34 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b131d89f00dea687fc5d44232d1cf6ce503659ca2ca810d63b17169d69eb5e00
|
4
|
+
data.tar.gz: 1e2d455ac8ca10a363b7bf89585f8bf0927dd06c94204d222a1384f421b4270d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a83c6e94d862c23c0f04e84cdf68d48c0aa4b4f51caba4000a6f5106831097c38343b10a553fc83fd3355e37a9b719befab007656b3a1626b2364b76f8db35a
|
7
|
+
data.tar.gz: 13828bd3771752722aa0fe5eb0c7f8f305b6f447bf8f0310e71c5df33e4810d5f071fa2cdef39cbcdfc17a2eff2e9e4e12b2f37675aff1c6fbda0d5d4b1b9a24
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.44
|
data/lib/tasks/rubocop.rake
CHANGED
@@ -15,12 +15,24 @@
|
|
15
15
|
#
|
16
16
|
#++
|
17
17
|
|
18
|
+
# the default old version used
|
19
|
+
OLD_RUBOCOP_VERSION = "0.41.2"
|
20
|
+
|
21
|
+
def rubocop_version
|
22
|
+
return @rubocop_version if @rubocop_version
|
23
|
+
|
24
|
+
@rubocop_version = if File.read(".rubocop.yml").match(/rubocop-(\d+\.\d+\.\d+)/)
|
25
|
+
Regexp.last_match[1]
|
26
|
+
else
|
27
|
+
OLD_RUBOCOP_VERSION
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
18
31
|
def rubocop_bin
|
19
32
|
return @rubocop_bin if @rubocop_bin
|
20
33
|
return @rubocop_bin = ENV["RUBOCOP_BIN"] if ENV["RUBOCOP_BIN"]
|
21
34
|
|
22
|
-
|
23
|
-
binary = `/usr/sbin/update-alternatives --list rubocop | grep '#{version}'`.strip
|
35
|
+
binary = `/usr/sbin/update-alternatives --list rubocop | grep '#{rubocop_version}'`.strip
|
24
36
|
if !system("which #{binary}")
|
25
37
|
raise "cannot find proper version of rubocop binary in " \
|
26
38
|
"'/usr/sbin/update-alternatives --list rubocop'." \
|
@@ -32,18 +44,26 @@ end
|
|
32
44
|
# run Rubocop in parallel
|
33
45
|
# @param params [String] optional Rubocop parameters
|
34
46
|
def run_rubocop(params = "")
|
35
|
-
#
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
+
# newer Rubocop versions support the "-P" ("--parallel") option,
|
48
|
+
# but that is not compatible with the "-a" ("--auto-correct") option
|
49
|
+
if rubocop_version != OLD_RUBOCOP_VERSION && !params.to_s.match(/-a|--auto-correct/)
|
50
|
+
sh "#{rubocop_bin} -P #{params}"
|
51
|
+
else
|
52
|
+
# for older Rubocop or auto-correct mode manually start multiple instances in parallel
|
53
|
+
#
|
54
|
+
# how it works:
|
55
|
+
# 1) get the list of inspected files by Rubocop
|
56
|
+
# 2) shuffle it randomly (better would be evenly distribute them according to
|
57
|
+
# the analysis complexity but that is hard to evaluate and even simply
|
58
|
+
# distributing by file size turned out to be ineffective and slower than
|
59
|
+
# a simple random shuffling)
|
60
|
+
# 3) pass that as input for xargs
|
61
|
+
# a) use -P with number of processors to run the commands in parallel
|
62
|
+
# b) use -n to set the maximum number of files per process, this number
|
63
|
+
# is computed to equally distribute the files across the workers
|
64
|
+
sh "#{rubocop_bin} -L | sort -R | xargs -P`nproc` -n$(expr `#{rubocop_bin} -L | wc -l` / " \
|
65
|
+
"`nproc` + 1) #{rubocop_bin} #{params}"
|
66
|
+
end
|
47
67
|
end
|
48
68
|
|
49
69
|
namespace :check do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yast-rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.44
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Reidinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: packaging_rake_tasks
|