yast-rake 0.2.25 → 0.2.26

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/tasks/rubocop.rake +45 -0
  4. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d12eb18e8ba47e02c6bda6dbd18194662096f63e632c0f3adb16e449e76ae0fa
4
- data.tar.gz: 552d75f1bd5c9775be525e82e73592937c9e64e082e4b1743b6a91ad838cef30
3
+ metadata.gz: bdded9659f2fd5a53bde7e031db894092098cd1d975e373105af573c1bd21525
4
+ data.tar.gz: d888aeb8f92dfb29418b29e952c29d49b309710814d57989c155d6c1a44d4717
5
5
  SHA512:
6
- metadata.gz: 9275b18bc4c777169d559d06c76afb3962c1122339bc89c2e93a696ae654789c9c12f1f89cdbb3c05f95275ff03806b3bc8923cadc6e0914834bada80220f9f5
7
- data.tar.gz: 05203405fba92d957e5d4a2dd4f43d0f2f1f618ff2bd76371062f6b332f4baf96e313dc7a1ed59e52501b29de42c6f8707299950289816c92faf4a66293cce87
6
+ metadata.gz: 991cb3c588b988ccf313e907d04e6e960f862e058a55a2010111f2ae1941d57e40b2d25a86ecb761cf3b315eda6ac64df42733faf31b3115ea11b8ca06602b06
7
+ data.tar.gz: 1c2a32a544d67b501b420401e8b63098cf43cccdc4ecbf71fed547aa40281b0e046952d29c6bd0c950969f400e55472be604234db09a23812a34e31ed1d005cb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.25
1
+ 0.2.26
@@ -0,0 +1,45 @@
1
+ #--
2
+ # Yast rake
3
+ #
4
+ # Copyright (C) 2018 SUSE LLC
5
+ # This library is free software; you can redistribute it and/or modify
6
+ # it only under the terms of version 2.1 of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful, but WITHOUT
10
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12
+ # details.
13
+ #
14
+ #++
15
+
16
+ # run Rubocop in parallel
17
+ # @param params [String] optional Rubocop parameters
18
+ def run_rubocop(params = "")
19
+ # how it works:
20
+ # 1) get the list of inspected files by Rubocop
21
+ # 2) shuffle it randomly (better would be evenly distribute them according to
22
+ # the analysis complexity but that is hard to evaluate and even simply
23
+ # distributing by file size turned out to be ineffective and slower than
24
+ # a simple random shuffling)
25
+ # 3) pass that as input for xargs
26
+ # a) use -P with number of processors to run the commands in parallel
27
+ # b) use -n to set the maximum number of files per process, this number
28
+ # is computed to equally distribute the files across the workers
29
+ sh "rubocop -L | sort -R | xargs -P`nproc` -n$(expr `rubocop -L | wc -l` / " \
30
+ "`nproc` + 1) rubocop #{params}"
31
+ end
32
+
33
+ namespace :check do
34
+ desc "Run Rubocop in parallel"
35
+ task :rubocop, [:options] do |_task, args|
36
+ args.with_defaults = { options: "" }
37
+ run_rubocop(args[:options])
38
+ end
39
+
40
+ desc "Run Rubocop in parallel in the auto correct mode"
41
+ task :"rubocop:auto_correct", [:options] do |_task, args|
42
+ args.with_defaults = { options: "" }
43
+ run_rubocop("-a #{args[:options]}")
44
+ end
45
+ end
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.25
4
+ version: 0.2.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Reidinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-18 00:00:00.000000000 Z
11
+ date: 2018-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -52,6 +52,7 @@ files:
52
52
  - data/targets.yml
53
53
  - lib/tasks/install.rake
54
54
  - lib/tasks/pot.rake
55
+ - lib/tasks/rubocop.rake
55
56
  - lib/tasks/run.rake
56
57
  - lib/tasks/spell.yml
57
58
  - lib/tasks/spellcheck.rake