quality 1.2.0 → 1.3.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 +4 -4
- data/Rakefile +5 -3
- data/lib/quality/command_output_processor.rb +1 -1
- data/lib/quality/quality_checker.rb +10 -8
- data/lib/quality/rake/task.rb +10 -7
- data/lib/quality/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 350f6c6730ee079bb5d55ac825ccbfd41e2fdfd2
|
4
|
+
data.tar.gz: 4c6c2f025cde6d119766c48c945e9edbd18fe032
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c77587613d9841670e38b35623dd180326b3fc12c1a01b671a6ceec66eddc9c9b5fa4a7cabb9eef3b395a5fecc8801b6bba9277e07927ddcc571adccf49bfbf1
|
7
|
+
data.tar.gz: 27690620eda4e95a5cd3f53590b06235ec28e8c7f4ca870f8dc3a2f447203d6a6cd898fff7e8ccd9b874e4b5daada3a318268ed5771c6b8e281138a872af7b43
|
data/Rakefile
CHANGED
@@ -16,9 +16,9 @@ CLOBBER.include("#{BUILD_DIR}/*")
|
|
16
16
|
|
17
17
|
Dir['tasks/**/*.rake'].each { |t| load t }
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
Quality::Rake::Task.new do |t|
|
20
|
+
t.skip_tools = ['reek']
|
21
|
+
end
|
22
22
|
|
23
23
|
task :clear_metrics do |t|
|
24
24
|
puts Time.now
|
@@ -30,3 +30,5 @@ task :clear_metrics do |t|
|
|
30
30
|
end
|
31
31
|
|
32
32
|
task :localtest => [:clear_metrics, :test, :quality]
|
33
|
+
|
34
|
+
task :default => [:localtest]
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'command_output_processor'
|
2
|
+
require 'English'
|
2
3
|
|
3
4
|
module Quality
|
4
5
|
# Runs a quality-checking, command, checks it agaist the existing
|
@@ -30,7 +31,7 @@ module Quality
|
|
30
31
|
processor = @command_output_processor_class.new
|
31
32
|
processor.emacs_format = @command_options[:emacs_format]
|
32
33
|
exit_status = run_command(processor, &count_violations_on_line)
|
33
|
-
[processor,
|
34
|
+
[processor, exit_status]
|
34
35
|
end
|
35
36
|
|
36
37
|
def run_command(processor, &count_violations_on_line)
|
@@ -38,14 +39,15 @@ module Quality
|
|
38
39
|
processor.file = file
|
39
40
|
@command_output = processor.process!(&count_violations_on_line)
|
40
41
|
end
|
42
|
+
$CHILD_STATUS.exitstatus
|
41
43
|
end
|
42
44
|
|
43
45
|
def check_exit_status(exit_status)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
return if @command_options[:gives_error_code_on_violations]
|
47
|
+
|
48
|
+
if exit_status != 0
|
49
|
+
fail("Error detected running #{full_cmd}. " \
|
50
|
+
"Exit status is #{exit_status}, output is [#{out}]")
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
@@ -61,8 +63,8 @@ module Quality
|
|
61
63
|
existing = existing_violations
|
62
64
|
report_violations(existing)
|
63
65
|
if @violations > existing
|
64
|
-
fail("Output from #{@cmd}\n\n#{@command_output}\n\n"
|
65
|
-
"Reduce total number of #{@cmd} violations "
|
66
|
+
fail("Output from #{@cmd}\n\n#{@command_output}\n\n" \
|
67
|
+
"Reduce total number of #{@cmd} violations " \
|
66
68
|
"to #{existing} or below!")
|
67
69
|
elsif @violations < existing
|
68
70
|
puts 'Ratcheting quality up...'
|
data/lib/quality/rake/task.rb
CHANGED
@@ -6,12 +6,10 @@ require 'rbconfig'
|
|
6
6
|
require_relative '../quality_checker'
|
7
7
|
|
8
8
|
module Quality
|
9
|
-
|
10
9
|
#
|
11
10
|
# Defines a task library for running quality's various tools
|
12
11
|
#
|
13
12
|
module Rake
|
14
|
-
|
15
13
|
# A Rake task that run quality tools on a set of source files, and
|
16
14
|
# enforce a ratcheting quality level.
|
17
15
|
#
|
@@ -26,7 +24,6 @@ module Quality
|
|
26
24
|
#
|
27
25
|
# rake quality
|
28
26
|
class Task < ::Rake::TaskLib
|
29
|
-
|
30
27
|
# Name of quality task.
|
31
28
|
# Defaults to :quality.
|
32
29
|
attr_accessor :quality_name
|
@@ -42,7 +39,7 @@ module Quality
|
|
42
39
|
|
43
40
|
# Array of directory names which contain ruby files to analyze.
|
44
41
|
#
|
45
|
-
# Defaults to %w
|
42
|
+
# Defaults to %w(lib test spec feature), which translates to *.rb in
|
46
43
|
# the base directory, as well as lib, test, and feature.
|
47
44
|
attr_writer :ruby_dirs
|
48
45
|
|
@@ -97,14 +94,20 @@ module Quality
|
|
97
94
|
private
|
98
95
|
|
99
96
|
def define # :nodoc:
|
100
|
-
desc 'Verify quality has increased or stayed '
|
97
|
+
desc 'Verify quality has increased or stayed ' \
|
101
98
|
'the same' unless ::Rake.application.last_comment
|
102
99
|
@dsl.define_task(quality_name) { run_quality }
|
103
100
|
@dsl.define_task(ratchet_name) { run_ratchet }
|
101
|
+
tools.each do |tool|
|
102
|
+
@dsl.define_task(tool) { run_quality_with_tool(tool) }
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def tools
|
107
|
+
%w(cane flog flay reek rubocop)
|
104
108
|
end
|
105
109
|
|
106
110
|
def run_quality
|
107
|
-
tools = ['cane', 'flog', 'flay', 'reek', 'rubocop']
|
108
111
|
tools.each do |tool|
|
109
112
|
run_quality_with_tool(tool)
|
110
113
|
end
|
@@ -181,7 +184,7 @@ module Quality
|
|
181
184
|
end
|
182
185
|
|
183
186
|
def ruby_dirs
|
184
|
-
@ruby_dirs ||= %w
|
187
|
+
@ruby_dirs ||= %w(lib test spec feature)
|
185
188
|
end
|
186
189
|
|
187
190
|
def ruby_files
|
data/lib/quality/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.3.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: 2014-
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cane
|