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 +4 -4
- data/README.md +0 -1
- data/lib/quality/quality_checker.rb +7 -12
- data/lib/quality/threshold.rb +28 -0
- data/lib/quality/tools/bigfiles.rb +2 -0
- data/lib/quality/tools/rubocop.rb +2 -0
- data/lib/quality/version.rb +1 -1
- data/quality.gemspec +9 -4
- metadata +56 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c6e41075a75632729495d06a8d99f5a96a5d3256ab509f99fda27a20c90425e
|
4
|
+
data.tar.gz: bb0f8c7a16417cd6c240d40c846f89518977a4a729a5f7102f63476922eca0e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
@
|
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
|
-
@
|
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
|
data/lib/quality/version.rb
CHANGED
data/quality.gemspec
CHANGED
@@ -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:
|
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:
|
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-
|
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:
|
404
|
+
name: rake
|
363
405
|
requirement: !ruby/object:Gem::Requirement
|
364
406
|
requirements:
|
365
|
-
- - "
|
407
|
+
- - "!="
|
366
408
|
- !ruby/object:Gem::Version
|
367
|
-
version:
|
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:
|
416
|
+
version: 10.4.2
|
375
417
|
- !ruby/object:Gem::Dependency
|
376
|
-
name:
|
418
|
+
name: rspec
|
377
419
|
requirement: !ruby/object:Gem::Requirement
|
378
420
|
requirements:
|
379
|
-
- - "
|
421
|
+
- - ">="
|
380
422
|
- !ruby/object:Gem::Version
|
381
|
-
version:
|
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:
|
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
|