hexx-suit 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +71 -0
- data/.yardopts +3 -0
- data/Guardfile +29 -0
- data/LICENSE +21 -0
- data/README.md +164 -0
- data/Rakefile +18 -0
- data/bin/hexx-suit +14 -0
- data/config/initializers/focus.rb +5 -0
- data/config/initializers/garbage_collection.rb +11 -0
- data/config/initializers/i18n.rb +3 -0
- data/config/initializers/metric_fu.rb +0 -0
- data/config/initializers/random_order.rb +4 -0
- data/config/initializers/rspec.rb +11 -0
- data/lib/hexx-suit.rb +16 -0
- data/lib/hexx/suit.rb +101 -0
- data/lib/hexx/suit/install.rb +85 -0
- data/lib/hexx/suit/install/Guardfile +6 -0
- data/lib/hexx/suit/install/Rakefile +17 -0
- data/lib/hexx/suit/install/_metrics +5 -0
- data/lib/hexx/suit/install/_rspec +2 -0
- data/lib/hexx/suit/install/_rubocop.yml +74 -0
- data/lib/hexx/suit/install/_yardopts +2 -0
- data/lib/hexx/suit/install/metrics/STYLEGUIDE +230 -0
- data/lib/hexx/suit/install/metrics/cane.yml +5 -0
- data/lib/hexx/suit/install/metrics/churn.yml +6 -0
- data/lib/hexx/suit/install/metrics/flay.yml +2 -0
- data/lib/hexx/suit/install/metrics/metric_fu.yml +15 -0
- data/lib/hexx/suit/install/metrics/pippi.yml +3 -0
- data/lib/hexx/suit/install/metrics/reek.yml +1 -0
- data/lib/hexx/suit/install/metrics/roodi.yml +24 -0
- data/lib/hexx/suit/install/metrics/rubocop.yml +79 -0
- data/lib/hexx/suit/install/metrics/saikuro.yml +3 -0
- data/lib/hexx/suit/install/metrics/simplecov.yml +8 -0
- data/lib/hexx/suit/install/metrics/yardstick.yml +37 -0
- data/lib/hexx/suit/metrics/base.rb +96 -0
- data/lib/hexx/suit/metrics/metric_fu.rb +165 -0
- data/lib/hexx/suit/metrics/metric_fu/base.rb +59 -0
- data/lib/hexx/suit/metrics/metric_fu/cane.rb +24 -0
- data/lib/hexx/suit/metrics/metric_fu/churn.rb +24 -0
- data/lib/hexx/suit/metrics/metric_fu/flay.rb +24 -0
- data/lib/hexx/suit/metrics/metric_fu/reek.rb +32 -0
- data/lib/hexx/suit/metrics/metric_fu/roodi.rb +32 -0
- data/lib/hexx/suit/metrics/metric_fu/saikuro.rb +24 -0
- data/lib/hexx/suit/metrics/pippi.rb +89 -0
- data/lib/hexx/suit/metrics/rubocop.rb +39 -0
- data/lib/hexx/suit/metrics/simplecov.rb +119 -0
- data/lib/hexx/suit/metrics/yardstick.rb +91 -0
- data/lib/hexx/suit/utils/system.rb +66 -0
- data/lib/hexx/suit/version.rb +7 -0
- data/lib/tasks/check.rake +32 -0
- data/lib/tasks/check/coverage.rake +27 -0
- data/lib/tasks/check/fu.rake +27 -0
- data/lib/tasks/check/inch.rake +11 -0
- data/lib/tasks/check/pippi.rake +31 -0
- data/lib/tasks/check/rubocop.rake +39 -0
- data/lib/tasks/check/yardstick.rake +27 -0
- data/lib/tasks/debug.rake +6 -0
- data/lib/tasks/test.rake +6 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/config/sandbox.rb +16 -0
- data/spec/support/config/tasks.rb +32 -0
- data/spec/support/sandbox/helpers.rb +62 -0
- data/spec/support/sandbox/matchers.rb +21 -0
- data/spec/tests/bin/install_spec.rb +29 -0
- data/spec/tests/lib/install_spec.rb +34 -0
- data/spec/tests/lib/metrics/metric_fu/cane_spec.rb +32 -0
- data/spec/tests/lib/metrics/metric_fu/churn_spec.rb +31 -0
- data/spec/tests/lib/metrics/metric_fu/flay_spec.rb +27 -0
- data/spec/tests/lib/metrics/metric_fu/reek_spec.rb +22 -0
- data/spec/tests/lib/metrics/metric_fu/roodi_spec.rb +22 -0
- data/spec/tests/lib/metrics/metric_fu/saikuro_spec.rb +30 -0
- data/spec/tests/lib/metrics/metric_fu_spec.rb +181 -0
- data/spec/tests/lib/metrics/pippi_spec.rb +102 -0
- data/spec/tests/lib/metrics/rubocop_spec.rb +58 -0
- data/spec/tests/lib/metrics/simplecov_spec.rb +102 -0
- data/spec/tests/lib/metrics/yardstick_spec.rb +110 -0
- data/spec/tests/lib/utils/system_spec.rb +85 -0
- data/spec/tests/suit_spec.rb +96 -0
- data/spec/tests/tasks/check/coverage/display_spec.rb +49 -0
- data/spec/tests/tasks/check/coverage/run_spec.rb +25 -0
- data/spec/tests/tasks/check/coverage_spec.rb +26 -0
- data/spec/tests/tasks/check/display_spec.rb +50 -0
- data/spec/tests/tasks/check/fu/display_spec.rb +42 -0
- data/spec/tests/tasks/check/fu/run_spec.rb +42 -0
- data/spec/tests/tasks/check/fu_spec.rb +18 -0
- data/spec/tests/tasks/check/inch_spec.rb +19 -0
- data/spec/tests/tasks/check/pippi/display_spec.rb +47 -0
- data/spec/tests/tasks/check/pippi/run_spec.rb +25 -0
- data/spec/tests/tasks/check/pippi_spec.rb +26 -0
- data/spec/tests/tasks/check/rubocop/display_spec.rb +61 -0
- data/spec/tests/tasks/check/rubocop/run_spec.rb +78 -0
- data/spec/tests/tasks/check/rubocop_spec.rb +26 -0
- data/spec/tests/tasks/check/run_spec.rb +44 -0
- data/spec/tests/tasks/check/yardstick/display_spec.rb +51 -0
- data/spec/tests/tasks/check/yardstick/run_spec.rb +20 -0
- data/spec/tests/tasks/check/yardstick_spec.rb +26 -0
- data/spec/tests/tasks/check_spec.rb +56 -0
- data/spec/tests/tasks/debug_spec.rb +21 -0
- data/spec/tests/tasks/test_spec.rb +21 -0
- metadata +414 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Hexx
|
4
|
+
module Suit
|
5
|
+
module Metrics
|
6
|
+
class MetricFu < Base
|
7
|
+
|
8
|
+
# The configurer for the Cane metric
|
9
|
+
class Cane < Base
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def name
|
14
|
+
:cane
|
15
|
+
end
|
16
|
+
|
17
|
+
def options
|
18
|
+
%w(abc_max line_length no_doc no_readme)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Hexx
|
4
|
+
module Suit
|
5
|
+
module Metrics
|
6
|
+
class MetricFu < Base
|
7
|
+
|
8
|
+
# The configurer for the Churn metric
|
9
|
+
class Churn < Base
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def name
|
14
|
+
:churn
|
15
|
+
end
|
16
|
+
|
17
|
+
def options
|
18
|
+
%w(ignore_files start_date minimum_churn_count)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Hexx
|
4
|
+
module Suit
|
5
|
+
module Metrics
|
6
|
+
class MetricFu < Base
|
7
|
+
|
8
|
+
# The configurer for the Flay metric
|
9
|
+
class Flay < Base
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def name
|
14
|
+
:flay
|
15
|
+
end
|
16
|
+
|
17
|
+
def options
|
18
|
+
%w(minimum_score)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Hexx
|
4
|
+
module Suit
|
5
|
+
module Metrics
|
6
|
+
class MetricFu < Base
|
7
|
+
|
8
|
+
# The configurer for the Reek metric
|
9
|
+
class Reek < Base
|
10
|
+
|
11
|
+
# @!scope class
|
12
|
+
# Changes settings source to config/metrics/reek.yml
|
13
|
+
#
|
14
|
+
# @return [self]
|
15
|
+
def load
|
16
|
+
configure do |metric|
|
17
|
+
metric.config_file_pattern = "config/metrics/reek.yml"
|
18
|
+
end
|
19
|
+
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def name
|
26
|
+
:reek
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Hexx
|
4
|
+
module Suit
|
5
|
+
module Metrics
|
6
|
+
class MetricFu < Base
|
7
|
+
|
8
|
+
# The configurer for the Roodi metric
|
9
|
+
class Roodi < Base
|
10
|
+
|
11
|
+
# @!scope class
|
12
|
+
# Changes settings source to config/metrics/roodi.yml
|
13
|
+
#
|
14
|
+
# @return [self]
|
15
|
+
def load
|
16
|
+
configure do |metric|
|
17
|
+
metric.roodi_config = "config/metrics/roodi.yml"
|
18
|
+
end
|
19
|
+
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def name
|
26
|
+
:roodi
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Hexx
|
4
|
+
module Suit
|
5
|
+
module Metrics
|
6
|
+
class MetricFu < Base
|
7
|
+
|
8
|
+
# The configurer for the Saikuro metric
|
9
|
+
class Saikuro < Base
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def name
|
14
|
+
:saikuro
|
15
|
+
end
|
16
|
+
|
17
|
+
def options
|
18
|
+
%w(warn_cyclo error_cyclo)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Hexx
|
2
|
+
module Suit
|
3
|
+
module Metrics
|
4
|
+
|
5
|
+
# Prepares and runs pippi environment
|
6
|
+
class Pippi < Base
|
7
|
+
|
8
|
+
# Constructs the object and loads 'pippi' gem dependency
|
9
|
+
#
|
10
|
+
# Loads pippi settings, prepares the log file,
|
11
|
+
# and sets ENV variables for the pippi rake tasks.
|
12
|
+
#
|
13
|
+
# @return [Hexx::Suit::Metrics::MetricFu]
|
14
|
+
#
|
15
|
+
# @api private
|
16
|
+
def self.new
|
17
|
+
require "pippi"
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
# @!scope class
|
22
|
+
# Prepares log file and sets ENV variables for pippi rake tasks
|
23
|
+
#
|
24
|
+
# @return [undefined]
|
25
|
+
def load
|
26
|
+
prepare_output
|
27
|
+
set_environment
|
28
|
+
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
# @!scope class
|
33
|
+
# Starts pippi AutoRunner
|
34
|
+
#
|
35
|
+
# @return [undefined]
|
36
|
+
def run
|
37
|
+
::Pippi::AutoRunner.new checkset: checkset, io: io
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
# pippi metric definitions
|
43
|
+
|
44
|
+
def name
|
45
|
+
:pippi
|
46
|
+
end
|
47
|
+
|
48
|
+
def default_options
|
49
|
+
{
|
50
|
+
"checkset" => "basic",
|
51
|
+
"output" => "tmp/pippi/output.log"
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
# operations
|
56
|
+
|
57
|
+
def prepare_output
|
58
|
+
SYSTEM.call %(
|
59
|
+
mkdir #{ File.dirname(output) } -p
|
60
|
+
touch #{ output }
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def set_environment
|
65
|
+
ENV["USE_PIPPI"] = "true"
|
66
|
+
ENV["PIPPI_OUTPUT"] = output
|
67
|
+
end
|
68
|
+
|
69
|
+
# helpers
|
70
|
+
|
71
|
+
def options
|
72
|
+
@options ||= default_options.merge settings.to_h
|
73
|
+
end
|
74
|
+
|
75
|
+
def output
|
76
|
+
@output ||= options["output"]
|
77
|
+
end
|
78
|
+
|
79
|
+
def io
|
80
|
+
::File.open(output, "w")
|
81
|
+
end
|
82
|
+
|
83
|
+
def checkset
|
84
|
+
options["checkset"]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Hexx
|
2
|
+
module Suit
|
3
|
+
module Metrics
|
4
|
+
|
5
|
+
# Prepares and runs rubocop environment from '.hexx-suit.yml'
|
6
|
+
class Rubocop < Base
|
7
|
+
|
8
|
+
# @!scope class
|
9
|
+
# Sets ENV variables for rubocop rake tasks
|
10
|
+
#
|
11
|
+
# @return [self]
|
12
|
+
def load
|
13
|
+
ENV["RUBOCOP_FORMAT"] = options["format"]
|
14
|
+
ENV["RUBOCOP_OUTPUT"] = options["output"]
|
15
|
+
|
16
|
+
self
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# rubocop metric definitions
|
22
|
+
|
23
|
+
def name
|
24
|
+
:rubocop
|
25
|
+
end
|
26
|
+
|
27
|
+
def default_options
|
28
|
+
{ "format" => "html", "output" => "tmp/rubocop/index.html" }
|
29
|
+
end
|
30
|
+
|
31
|
+
# helpers
|
32
|
+
|
33
|
+
def options
|
34
|
+
@options ||= default_options.merge settings.to_h
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
module Hexx
|
2
|
+
module Suit
|
3
|
+
module Metrics
|
4
|
+
|
5
|
+
# Prepares and runs pippi environment
|
6
|
+
#
|
7
|
+
# @api private
|
8
|
+
class SimpleCov < Base
|
9
|
+
|
10
|
+
# Loads the simplecov and coveralls gem
|
11
|
+
#
|
12
|
+
# @return [Hexx::Suit::Metrics::SimpleCov]
|
13
|
+
#
|
14
|
+
# @api private
|
15
|
+
def self.new
|
16
|
+
%w(simplecov coveralls).each { |gem| require gem }
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
# @!scope class
|
21
|
+
# Configures the SimpleCov metric
|
22
|
+
#
|
23
|
+
# @return [self]
|
24
|
+
def load
|
25
|
+
set_environment
|
26
|
+
configure_metric
|
27
|
+
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
31
|
+
# @!scope class
|
32
|
+
# Configures simplecov from the simplecov.yml file and starts
|
33
|
+
# the metric
|
34
|
+
#
|
35
|
+
# @return [undefined]
|
36
|
+
def run
|
37
|
+
metric.start
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
# simplecov metric definitions
|
43
|
+
|
44
|
+
def name
|
45
|
+
"simplecov"
|
46
|
+
end
|
47
|
+
|
48
|
+
def metric
|
49
|
+
::SimpleCov
|
50
|
+
end
|
51
|
+
|
52
|
+
def default_options
|
53
|
+
{
|
54
|
+
"output" => "tmp/coverage",
|
55
|
+
"filters" => ["spec/", "config/"],
|
56
|
+
"groups" => {
|
57
|
+
"Libraries" => "lib/",
|
58
|
+
"Application" => "app/"
|
59
|
+
}
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# operations
|
64
|
+
|
65
|
+
def set_environment
|
66
|
+
ENV["USE_SIMPLECOV"] = "true"
|
67
|
+
ENV["SIMPLECOV_OUTPUT"] = "#{ output }/index.html"
|
68
|
+
end
|
69
|
+
|
70
|
+
def configure_metric
|
71
|
+
add_filters
|
72
|
+
add_groups
|
73
|
+
set_formatters
|
74
|
+
set_output
|
75
|
+
end
|
76
|
+
|
77
|
+
def add_filters
|
78
|
+
filters.each(&metric.method(:add_filter))
|
79
|
+
end
|
80
|
+
|
81
|
+
def add_groups
|
82
|
+
groups.each { |key, value| metric.add_group(key, value) }
|
83
|
+
end
|
84
|
+
|
85
|
+
def set_formatters
|
86
|
+
metric.formatter = metric::Formatter::MultiFormatter[
|
87
|
+
metric::Formatter::HTMLFormatter,
|
88
|
+
::Coveralls::SimpleCov::Formatter
|
89
|
+
]
|
90
|
+
end
|
91
|
+
|
92
|
+
def set_output
|
93
|
+
metric.coverage_dir output
|
94
|
+
end
|
95
|
+
|
96
|
+
# helpers
|
97
|
+
|
98
|
+
def options
|
99
|
+
@options ||= default_options.merge settings.to_h
|
100
|
+
end
|
101
|
+
|
102
|
+
def output
|
103
|
+
@output = options["output"]
|
104
|
+
end
|
105
|
+
|
106
|
+
def filters
|
107
|
+
@filters ||= Array(options["filters"]).flatten.map(&:to_s)
|
108
|
+
end
|
109
|
+
|
110
|
+
def groups
|
111
|
+
@groups ||= begin
|
112
|
+
list = options["groups"]
|
113
|
+
list.is_a?(Hash) ? list : {}
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module Hexx
|
2
|
+
module Suit
|
3
|
+
module Metrics
|
4
|
+
|
5
|
+
# Prepares and runs yardstick environment from '.hexx-suit.yml'
|
6
|
+
class Yardstick < Base
|
7
|
+
|
8
|
+
# Loads yardstick verifier
|
9
|
+
#
|
10
|
+
# @return [Hexx::Suit::Metrics::Yardstick]
|
11
|
+
#
|
12
|
+
# @api private
|
13
|
+
def self.new
|
14
|
+
require "yardstick/rake/measurement"
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# @!scope class
|
19
|
+
# Prepares output for the yardstick and sets the YARDSTICK_OUTPUT env
|
20
|
+
#
|
21
|
+
# @return [self]
|
22
|
+
def load
|
23
|
+
prepare_output
|
24
|
+
set_environment
|
25
|
+
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
# @!scope class
|
30
|
+
# Runs yardstick with options from '.hexx-suit.yml'
|
31
|
+
#
|
32
|
+
# @return [undefined]
|
33
|
+
def run
|
34
|
+
measurement.yardstick_measure
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
# yardstic metric definitions
|
40
|
+
|
41
|
+
def name
|
42
|
+
"yardstick"
|
43
|
+
end
|
44
|
+
|
45
|
+
def default_options
|
46
|
+
{
|
47
|
+
"output" => "tmp/yardstick/output.log",
|
48
|
+
"path" => "lib/**/*.rb"
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
def metric
|
53
|
+
::Yardstick::Rake::Measurement
|
54
|
+
end
|
55
|
+
|
56
|
+
# operations
|
57
|
+
|
58
|
+
def prepare_output
|
59
|
+
SYSTEM.call %(
|
60
|
+
mkdir #{ ::File.dirname(output) } -p
|
61
|
+
touch #{ output }
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
def set_environment
|
66
|
+
ENV["YARDSTICK_OUTPUT"] = output
|
67
|
+
end
|
68
|
+
|
69
|
+
# helpers
|
70
|
+
|
71
|
+
def measurement
|
72
|
+
metric.new(:yardstick_measure, options) do |config|
|
73
|
+
config.output = output
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def options
|
78
|
+
@options ||= begin
|
79
|
+
list = default_options.merge settings.to_h
|
80
|
+
list["path"] = Array(list["path"]).join(" ")
|
81
|
+
list
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def output
|
86
|
+
@output ||= options["output"]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|