rubycritic 4.6.1 → 4.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cdf1485043408cdfbf9a8a0a468f7b20163c2bd982314547d733aca7d185d88
4
- data.tar.gz: 365505ba0aedce90a370be8a8ccdc8277f33c2b637c8e1e22f350530240d9889
3
+ metadata.gz: 9223069d4934bf55e41bd199b4610e9b230b4115d36196354d4aa93d87b8ea01
4
+ data.tar.gz: 7d1b324b4df74ac99bb1103c6f80678a90e872418eac4faa87dd2f687cdb87cc
5
5
  SHA512:
6
- metadata.gz: 5e5718fea056a233dcaab942dfe0529230d371ff1ef6fb71711283535c9aa85aab5cd07be697ec97d605574fbce7329e60f69aa608ca0504b54df094c5b65c46
7
- data.tar.gz: 301500666e876676cc4caeaa2be96ed33b863dd7cad8b47b8f35461f665b7bc3ae66aa3fe3522466d5f42be679b525625bbe8c3b381da4c9015556c8b2bed348
6
+ metadata.gz: 91abe36adad615bf645187214511346e8175f28f913462baaa31b0be4bdf1986fa01e3841ff71866fa80f5de9d2e10d0ed6cd53dded35c30b04d2ad1910a5d6f
7
+ data.tar.gz: 6764cabd0cac4338072f4eadde37819095a10c3c5d5fd78d76d75ffe0e68d12ee58afe0169c286f3ea32fad9e91df145a9396e42154cbd446e78f8ee64b579ad
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
- # main [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.6.1...main)
1
+ # main [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.7.0...main)
2
2
 
3
- # v4.6.0 / 2021-01-28 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.6.0...v4.6.1)
3
+ # v4.7.0 / 2022-05-06 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.6.1...v4.7.0)
4
+
5
+ * [CHANGE] Run test suite with Ruby 3.1 (by [@etagwerker][])
6
+ * [FEATURE] Allow the Rake task generator to accept a description (by [@anicholson][])
7
+ * [CHANGE] Replace travis-ci with Github Actions for contributors (by [@RyanSnodgrass][])
8
+ * [CHANGE] Drop support for JRuby 9.1.x (by [@RyanSnodgrass][])
9
+ * [BUGFIX] Exit with 0 or 1 from Rake Task. Fixes #214 (by [@RyanSnodgrass][])
10
+
11
+ # v4.6.1 / 2021-01-28 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.6.0...v4.6.1)
4
12
 
5
13
  * [CHANGE] CI: Drop rbx-3 from matrix, does not install (by [@olleolleolle][])
6
14
  * [CHANGE] Add support for Ruby 3.0 (by [@etagwerker][])
@@ -13,6 +21,8 @@
13
21
  * [BUGFIX] Fix directory structure of reports when comparing branches (by [@denny][])
14
22
  * [BUGFIX] Restrict simplecov to versions before data format changed (by [@denny][])
15
23
 
24
+ * [BUGFIX] Handle missing comparison file in html template (by @lauratpa)
25
+
16
26
  # v4.5.2 / 2020-08-20 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.5.1...v4.5.2)
17
27
 
18
28
  * [BUGFIX] Handle simplecov v0.19 and install appraisal (by [@MZiserman][])
@@ -366,3 +376,4 @@
366
376
  [@jackcasey]: https://github.com/jackcasey
367
377
  [@sl4vr]: https://github.com/sl4vr
368
378
  [@denny]: https://github.com/denny
379
+ [@RyanSnodgrass]: https://github.com/RyanSnodgrass
data/README.md CHANGED
@@ -196,6 +196,9 @@ RubyCritic::RakeTask.new do |task|
196
196
 
197
197
  # Defaults to false
198
198
  task.verbose = true
199
+
200
+ # Fail the Rake task if RubyCritic doesn't pass. Defaults to true
201
+ task.fail_on_error = true
199
202
  end
200
203
  ```
201
204
 
@@ -208,6 +211,22 @@ RubyCritic::RakeTask.new do |task|
208
211
  end
209
212
  ```
210
213
 
214
+ If you wish to create multiple Rake tasks (e.g., for local & for ci-specific configuration), you can do so!
215
+ If you decide to do this, you should provide a clearer description for each task:
216
+
217
+ ```ruby
218
+ # for local
219
+ RubyCritic::RakeTask.new("local", "Run RubyCritic (local configuration)" do |task|
220
+ # ...
221
+ end
222
+
223
+ # for CI
224
+ RubyCritic::RakeTask.new("ci", "Run RubyCritic (CI configuration)" do |task|
225
+ task.options = "--mode-ci"
226
+ # ...
227
+ end
228
+ ```
229
+
211
230
  ## Formatters
212
231
 
213
232
  See [formatters](docs/formatters.md)
@@ -220,6 +239,7 @@ RubyCritic is supporting Ruby versions:
220
239
  * 2.5
221
240
  * 2.6
222
241
  * 2.7
242
+ * 3.0
223
243
 
224
244
  ## Improving RubyCritic
225
245
 
@@ -25,7 +25,9 @@
25
25
  <td class="center">
26
26
  <% if Config.build_mode? %>
27
27
  <% master_analysed_module = Config.base_branch_collection.find(analysed_module.pathname) %>
28
- <% if master_analysed_module.cost > analysed_module.cost %>
28
+ <% if !master_analysed_module %>
29
+ <span class="empty-span glyphicon"></span>
30
+ <% elsif master_analysed_module.cost > analysed_module.cost %>
29
31
  <span class="glyphicon glyphicon-arrow-up green-color"></span>
30
32
  <% elsif master_analysed_module.cost < analysed_module.cost %>
31
33
  <span class="glyphicon glyphicon-arrow-down red-color"></span>
@@ -36,11 +36,17 @@ module RubyCritic
36
36
  # "-p / --path" since that is set separately. Defaults to ''.
37
37
  attr_writer :options
38
38
 
39
- def initialize(name = :rubycritic)
40
- @name = name
41
- @paths = FileList['.']
42
- @options = ''
43
- @verbose = false
39
+ # Whether or not to fail Rake task when RubyCritic does not pass.
40
+ # Defaults to true.
41
+ attr_writer :fail_on_error
42
+
43
+ def initialize(name = :rubycritic, description = 'Run RubyCritic')
44
+ @name = name
45
+ @description = description
46
+ @paths = FileList['.']
47
+ @options = ''
48
+ @verbose = false
49
+ @fail_on_error = true
44
50
 
45
51
  yield self if block_given?
46
52
  define_task
@@ -48,20 +54,24 @@ module RubyCritic
48
54
 
49
55
  private
50
56
 
51
- attr_reader :name, :paths, :verbose, :options
57
+ attr_reader :name, :description, :paths, :verbose, :options, :fail_on_error
52
58
 
53
59
  def define_task
54
- desc 'Run RubyCritic'
60
+ desc description
55
61
  task(name) { run_task }
56
62
  end
57
63
 
58
64
  def run_task
59
- if verbose
60
- puts "\n\n!!! Running `#{name}` rake command\n"
61
- puts "!!! Inspecting #{paths} #{options.empty? ? '' : "with options #{options}"}\n\n"
62
- end
65
+ print_starting_up_output if verbose
63
66
  application = RubyCritic::Cli::Application.new(options_as_arguments + paths)
64
- application.execute
67
+ return unless application.execute.nonzero? && fail_on_error
68
+
69
+ abort('RubyCritic did not pass - exiting!')
70
+ end
71
+
72
+ def print_starting_up_output
73
+ puts "\n\n!!! Running `#{name}` rake command\n"
74
+ puts "!!! Inspecting #{paths} #{options.empty? ? '' : "with options #{options}"}\n\n"
65
75
  end
66
76
 
67
77
  def options_as_arguments
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyCritic
4
- VERSION = '4.6.1'.freeze
4
+ VERSION = '4.7.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.1
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilherme Simoes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-29 00:00:00.000000000 Z
11
+ date: 2022-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flay
@@ -542,7 +542,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
542
542
  - !ruby/object:Gem::Version
543
543
  version: '0'
544
544
  requirements: []
545
- rubygems_version: 3.2.3
545
+ rubygems_version: 3.2.15
546
546
  signing_key:
547
547
  specification_version: 4
548
548
  summary: RubyCritic is a Ruby code quality reporter