quality 36.1.0 → 37.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c66b37cdb110269046721f38cafb06eca1f8d96cec35d3c3ef2e5650d72e5ce
4
- data.tar.gz: 82e46462a6ffa1ebb9e5eda340b9cb9817e5057026f9b9f2a3898d5a86ed380f
3
+ metadata.gz: 5c6e41075a75632729495d06a8d99f5a96a5d3256ab509f99fda27a20c90425e
4
+ data.tar.gz: bb0f8c7a16417cd6c240d40c846f89518977a4a729a5f7102f63476922eca0e6
5
5
  SHA512:
6
- metadata.gz: 8901276ecd9d6e8ea29b568ee8f22e75acf7ebc08fb2641ed1604a203272983358f6d7df7f5756498e31f7b210802f105fce9f7a902148748970a6a6a539125a
7
- data.tar.gz: d3d62de966cf078e7201972bb60ac07b4582af0872b6e21b8ee3892376a158a17e05ba6a2e5b94ce35e7c9f36c7b839e529e682e3d30ee5d377732c297c73910
6
+ metadata.gz: 79be96733f293dffc553f942a66357becbd953061df2dfed6f3d4d7f8e78abdc6459e45da26a835bf068d1206912690a1124f9abc922aca84d309316fa6b15c9
7
+ data.tar.gz: 6a17209dd3f51ad443e3ebcfcce37a36c08d4e6b8ffeda64399dcfcc23484c49e63eca3782a6e0ca1a9adbb7f10683e85fdb520e9cc609f3e41ccaf798412aab
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # Quality -- code quality ratchet for Ruby
2
2
 
3
3
  [![Build Status](https://travis-ci.org/apiology/quality.png)](https://travis-ci.org/apiology/quality)
4
- [![Coverage Status](https://coveralls.io/repos/apiology/quality/badge.png?branch=master)](https://coveralls.io/r/apiology/quality?branch=master)
5
4
 
6
5
  ## Overview
7
6
 
@@ -3,6 +3,7 @@
3
3
  require_relative 'command_output_processor'
4
4
  require_relative 'process'
5
5
  require_relative 'ruby_spawn'
6
+ require_relative 'threshold'
6
7
 
7
8
  module Quality
8
9
  # Runs a quality-checking, command, checks it agaist the existing
@@ -28,7 +29,10 @@ module Quality
28
29
  @command_options = command_options
29
30
  @verbose = verbose
30
31
  @count_dir.mkdir(output_dir) unless @count_file.exists?(output_dir)
31
- @filename = File.join(output_dir, "#{cmd}_high_water_mark")
32
+ @threshold = Quality::Threshold.new(cmd,
33
+ count_io: count_io,
34
+ count_file: count_file,
35
+ output_dir: output_dir)
32
36
  @process_class = process_class
33
37
  end
34
38
 
@@ -70,14 +74,7 @@ module Quality
70
74
  MAX_VIOLATIONS = 9_999_999_999
71
75
 
72
76
  def existing_violations
73
- @existing_violations ||=
74
- begin
75
- if @count_file.exist?(@filename)
76
- @count_io.read(@filename).to_i
77
- else
78
- MAX_VIOLATIONS
79
- end
80
- end
77
+ @existing_violations ||= (@threshold.threshold || MAX_VIOLATIONS)
81
78
  end
82
79
 
83
80
  def rendered_full_cmd
@@ -126,9 +123,7 @@ module Quality
126
123
  end
127
124
 
128
125
  def write_violations(new_violations)
129
- @count_file.open(@filename, 'w') do |file|
130
- file.write(new_violations.to_s + "\n")
131
- end
126
+ @threshold.write_violations(new_violations)
132
127
  end
133
128
  end
134
129
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Quality
4
+ # Calculate threshold for quality gem tool
5
+ class Threshold
6
+ attr_reader :tool_name
7
+
8
+ def initialize(tool_name,
9
+ count_file: File,
10
+ count_io: IO,
11
+ output_dir: 'metrics')
12
+ @tool_name = tool_name
13
+ @count_file = count_file
14
+ @count_io = count_io
15
+ @filename = File.join(output_dir, "#{tool_name}_high_water_mark")
16
+ end
17
+
18
+ def threshold
19
+ return @count_io.read(@filename).to_i if @count_file.exist?(@filename)
20
+ end
21
+
22
+ def write_violations(new_violations)
23
+ @count_file.open(@filename, 'w') do |file|
24
+ file.write(new_violations.to_s + "\n")
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative '../tool'
4
+
3
5
  module Quality
4
6
  module Tools
5
7
  # Adds 'bigfiles' tool support to quality gem
@@ -7,6 +7,8 @@ module Quality
7
7
  def rubocop_args
8
8
  [
9
9
  '--force-exclusion',
10
+ '--require rubocop-minitest',
11
+ '--require rubocop-rake',
10
12
  '--require rubocop-rspec',
11
13
  '--format emacs',
12
14
  *ruby_files,
@@ -4,5 +4,5 @@
4
4
  # reek, flog, flay and rubocop and makes sure your numbers don't get
5
5
  # any worse over time.
6
6
  module Quality
7
- VERSION = '36.1.0'
7
+ VERSION = '37.0.0'
8
8
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  # frozen_string_literal: true
3
2
 
4
3
  # ; -*-Ruby-*-
@@ -49,7 +48,15 @@ Gem::Specification.new do |s|
49
48
  s.add_runtime_dependency('brakeman')
50
49
  s.add_runtime_dependency('punchlist', ['>= 1.1'])
51
50
  s.add_runtime_dependency('rails_best_practices')
51
+ s.add_runtime_dependency('rubocop-minitest')
52
+ s.add_runtime_dependency('rubocop-rake')
52
53
  s.add_runtime_dependency('rubocop-rspec', ['>=1.19.0'])
54
+ # not directly required - this is to workaround this issue:
55
+ # https://github.com/octokit/octokit.rb/issues/1177
56
+ #
57
+ # This causes:
58
+ # "uninitialized constant Faraday::Error::ClientError (NameError)"
59
+ s.add_runtime_dependency('faraday', ['<1'])
53
60
 
54
61
  # need above 3.2.2 to support Ruby 2.0 syntax
55
62
  #
@@ -63,13 +70,11 @@ Gem::Specification.new do |s|
63
70
  # Workaround for
64
71
  # https://github.com/bundler/bundler/issues/3401
65
72
  s.add_development_dependency('minitest', ['~> 5'])
66
- # https://github.com/apiology/quality/issues/121
67
- # https://github.com/freerange/mocha/issues/436
68
73
  s.add_development_dependency('mocha')
69
74
  s.add_development_dependency('pronto')
70
75
  s.add_development_dependency('pronto-flake8')
71
76
  s.add_development_dependency('pronto-punchlist')
72
- s.add_development_dependency('pronto-reek')
73
77
  s.add_development_dependency('pronto-rubocop')
74
78
  s.add_development_dependency('rake', ['!= 10.4.2'])
79
+ s.add_development_dependency('rspec')
75
80
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quality
3
3
  version: !ruby/object:Gem::Version
4
- version: 36.1.0
4
+ version: 37.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-27 00:00:00.000000000 Z
11
+ date: 2020-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -212,6 +212,34 @@ dependencies:
212
212
  - - ">="
213
213
  - !ruby/object:Gem::Version
214
214
  version: '0'
215
+ - !ruby/object:Gem::Dependency
216
+ name: rubocop-minitest
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ type: :runtime
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - ">="
227
+ - !ruby/object:Gem::Version
228
+ version: '0'
229
+ - !ruby/object:Gem::Dependency
230
+ name: rubocop-rake
231
+ requirement: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - ">="
234
+ - !ruby/object:Gem::Version
235
+ version: '0'
236
+ type: :runtime
237
+ prerelease: false
238
+ version_requirements: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - ">="
241
+ - !ruby/object:Gem::Version
242
+ version: '0'
215
243
  - !ruby/object:Gem::Dependency
216
244
  name: rubocop-rspec
217
245
  requirement: !ruby/object:Gem::Requirement
@@ -226,6 +254,20 @@ dependencies:
226
254
  - - ">="
227
255
  - !ruby/object:Gem::Version
228
256
  version: 1.19.0
257
+ - !ruby/object:Gem::Dependency
258
+ name: faraday
259
+ requirement: !ruby/object:Gem::Requirement
260
+ requirements:
261
+ - - "<"
262
+ - !ruby/object:Gem::Version
263
+ version: '1'
264
+ type: :runtime
265
+ prerelease: false
266
+ version_requirements: !ruby/object:Gem::Requirement
267
+ requirements:
268
+ - - "<"
269
+ - !ruby/object:Gem::Version
270
+ version: '1'
229
271
  - !ruby/object:Gem::Dependency
230
272
  name: ruby_parser
231
273
  requirement: !ruby/object:Gem::Requirement
@@ -345,7 +387,7 @@ dependencies:
345
387
  - !ruby/object:Gem::Version
346
388
  version: '0'
347
389
  - !ruby/object:Gem::Dependency
348
- name: pronto-reek
390
+ name: pronto-rubocop
349
391
  requirement: !ruby/object:Gem::Requirement
350
392
  requirements:
351
393
  - - ">="
@@ -359,33 +401,33 @@ dependencies:
359
401
  - !ruby/object:Gem::Version
360
402
  version: '0'
361
403
  - !ruby/object:Gem::Dependency
362
- name: pronto-rubocop
404
+ name: rake
363
405
  requirement: !ruby/object:Gem::Requirement
364
406
  requirements:
365
- - - ">="
407
+ - - "!="
366
408
  - !ruby/object:Gem::Version
367
- version: '0'
409
+ version: 10.4.2
368
410
  type: :development
369
411
  prerelease: false
370
412
  version_requirements: !ruby/object:Gem::Requirement
371
413
  requirements:
372
- - - ">="
414
+ - - "!="
373
415
  - !ruby/object:Gem::Version
374
- version: '0'
416
+ version: 10.4.2
375
417
  - !ruby/object:Gem::Dependency
376
- name: rake
418
+ name: rspec
377
419
  requirement: !ruby/object:Gem::Requirement
378
420
  requirements:
379
- - - "!="
421
+ - - ">="
380
422
  - !ruby/object:Gem::Version
381
- version: 10.4.2
423
+ version: '0'
382
424
  type: :development
383
425
  prerelease: false
384
426
  version_requirements: !ruby/object:Gem::Requirement
385
427
  requirements:
386
- - - "!="
428
+ - - ">="
387
429
  - !ruby/object:Gem::Version
388
- version: 10.4.2
430
+ version: '0'
389
431
  description: Quality is a tool that runs quality checks on your code using community
390
432
  tools, and makes sure your numbers don't get any worse over time. Just add 'rake
391
433
  quality' as part of your Continuous Integration
@@ -406,6 +448,7 @@ files:
406
448
  - lib/quality/rake/task.rb
407
449
  - lib/quality/ruby_spawn.rb
408
450
  - lib/quality/runner.rb
451
+ - lib/quality/threshold.rb
409
452
  - lib/quality/tool.rb
410
453
  - lib/quality/tools/bigfiles.rb
411
454
  - lib/quality/tools/brakeman.rb