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,85 @@
|
|
1
|
+
module Hexx
|
2
|
+
module Suit
|
3
|
+
|
4
|
+
# The generator creates a Rakefile in a destination root
|
5
|
+
class Install < Thor::Group
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
# @!scope class
|
9
|
+
# @!method start(args)
|
10
|
+
# Populates the necessary files into current directory
|
11
|
+
#
|
12
|
+
# @param [Array<String>] args An array of arguments from CLI (ARGV etc.)
|
13
|
+
#
|
14
|
+
# @return [undefined]
|
15
|
+
#
|
16
|
+
# @api public
|
17
|
+
|
18
|
+
# Root folder for the generator's templates
|
19
|
+
#
|
20
|
+
# @return [String]
|
21
|
+
#
|
22
|
+
# @api private
|
23
|
+
def self.source_root
|
24
|
+
@source_root ||= File.expand_path "../install", __FILE__
|
25
|
+
end
|
26
|
+
|
27
|
+
namespace :install
|
28
|
+
desc "Installs the 'hexx-suit' gem."
|
29
|
+
|
30
|
+
# Creates the Rakefile
|
31
|
+
#
|
32
|
+
# @return [undefined]
|
33
|
+
#
|
34
|
+
# @api private
|
35
|
+
def create_rakefile
|
36
|
+
copy_file "Rakefile"
|
37
|
+
end
|
38
|
+
|
39
|
+
# Creates the Guardfile
|
40
|
+
#
|
41
|
+
# @return [undefined]
|
42
|
+
#
|
43
|
+
# @api private
|
44
|
+
def create_guardfile
|
45
|
+
copy_file "Guardfile"
|
46
|
+
end
|
47
|
+
|
48
|
+
# Creates the .rspec settings
|
49
|
+
#
|
50
|
+
# @return [undefined]
|
51
|
+
#
|
52
|
+
# @api private
|
53
|
+
def create_rspec
|
54
|
+
copy_file "_rspec", ".rspec"
|
55
|
+
end
|
56
|
+
|
57
|
+
# Creates the .yardopts settings
|
58
|
+
#
|
59
|
+
# @return [undefined]
|
60
|
+
#
|
61
|
+
# @api private
|
62
|
+
def create_yardopts
|
63
|
+
copy_file "_yardopts", ".yardopts"
|
64
|
+
end
|
65
|
+
|
66
|
+
# creates the metric settings
|
67
|
+
#
|
68
|
+
# @return [undefined]
|
69
|
+
#
|
70
|
+
# @api private
|
71
|
+
def create_metrics
|
72
|
+
directory "metrics", "config/metrics"
|
73
|
+
end
|
74
|
+
|
75
|
+
# creates metric_fu loader
|
76
|
+
#
|
77
|
+
# @return [undefined]
|
78
|
+
#
|
79
|
+
# @api private
|
80
|
+
def create_metrics_loader
|
81
|
+
copy_file "_metrics", ".metrics"
|
82
|
+
end
|
83
|
+
end # class Install
|
84
|
+
end # module Suit
|
85
|
+
end # module Hexx
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
begin
|
3
|
+
require "bundler/setup"
|
4
|
+
rescue LoadError
|
5
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
6
|
+
exit
|
7
|
+
end
|
8
|
+
|
9
|
+
# Loads bundler tasks
|
10
|
+
Bundler::GemHelper.install_tasks
|
11
|
+
|
12
|
+
# Loads the Hexx::Suit and its tasks
|
13
|
+
require "hexx-suit"
|
14
|
+
Hexx::Suit.install_tasks
|
15
|
+
|
16
|
+
# Sets the Hexx::Suit :test task to default
|
17
|
+
task default: :test
|
@@ -0,0 +1,74 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- '**/db/schema.rb'
|
4
|
+
|
5
|
+
Lint/HandleExceptions:
|
6
|
+
Exclude:
|
7
|
+
- 'spec/**/*'
|
8
|
+
|
9
|
+
Lint/RescueException:
|
10
|
+
Exclude:
|
11
|
+
- 'spec/**/*'
|
12
|
+
|
13
|
+
Metrics/ClassLength:
|
14
|
+
Exclude:
|
15
|
+
- 'lib/**/generator*'
|
16
|
+
|
17
|
+
Style/AccessorMethodName:
|
18
|
+
Exclude:
|
19
|
+
- 'spec/**/*'
|
20
|
+
|
21
|
+
Style/AsciiComments:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/ClassAndModuleChildren:
|
25
|
+
Exclude:
|
26
|
+
- 'spec/**/*'
|
27
|
+
|
28
|
+
Style/Documentation:
|
29
|
+
Exclude:
|
30
|
+
- 'lib/**/version.rb'
|
31
|
+
- 'spec/**/*'
|
32
|
+
|
33
|
+
Style/EmptyLinesAroundBlockBody:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Style/EmptyLinesAroundClassBody:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/EmptyLinesAroundMethodBody:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Style/EmptyLinesAroundModuleBody:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/EmptyLineBetweenDefs:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/FileName:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Style/RaiseArgs:
|
52
|
+
EnforcedStyle: compact
|
53
|
+
|
54
|
+
Style/SingleLineMethods:
|
55
|
+
Exclude:
|
56
|
+
- 'spec/**/*'
|
57
|
+
|
58
|
+
Style/SingleSpaceBeforeFirstArg:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
Style/SpecialGlobalVars:
|
62
|
+
Exclude:
|
63
|
+
- 'Gemfile'
|
64
|
+
- '*.gemspec'
|
65
|
+
|
66
|
+
Style/StringLiterals:
|
67
|
+
EnforcedStyle: double_quotes
|
68
|
+
|
69
|
+
Stype/StringLiteralsInInterpolation:
|
70
|
+
EnforcedStyle: double_quotes
|
71
|
+
|
72
|
+
Style/TrivialAccessors:
|
73
|
+
Exclude:
|
74
|
+
- 'spec/**/*'
|
@@ -0,0 +1,230 @@
|
|
1
|
+
= Ruby Style Guide
|
2
|
+
|
3
|
+
Adapted from Dan Kubb's Ruby Style Guide
|
4
|
+
https://github.com/dkubb/styleguide/blob/master/RUBY-STYLE
|
5
|
+
|
6
|
+
== Commiting:
|
7
|
+
|
8
|
+
* Write descriptive commit messages, following the pattern:
|
9
|
+
|
10
|
+
[TYPE] name
|
11
|
+
|
12
|
+
The message, describing the changes being made
|
13
|
+
|
14
|
+
* Use the types below to mark commits:
|
15
|
+
|
16
|
+
- FEATURE - for adding new features, or backward-compatible changes;
|
17
|
+
- CHANGE - for backward-incompatible changes;
|
18
|
+
- BUG FIX - for fixing bugs;
|
19
|
+
- REFACTORING - for other changes of the code not affecting the API;
|
20
|
+
- OTHER - for changes in documentaton, metrics etc, not touching the code;
|
21
|
+
- VERSION - for version changes.
|
22
|
+
|
23
|
+
* Always separate commits of different types (such as FEATURE and CHANGE).
|
24
|
+
|
25
|
+
* Try to separate various features from each other.
|
26
|
+
|
27
|
+
* Include specification to the same commit as the code.
|
28
|
+
|
29
|
+
* Run all tests before making a commit.
|
30
|
+
Never commit the code that break unit tests.
|
31
|
+
|
32
|
+
* Use metric (run `rake check`) before making a commit.
|
33
|
+
|
34
|
+
* Do refactoring before making a commit. Best writing is rewriting.
|
35
|
+
|
36
|
+
* Follow semantic versioning.
|
37
|
+
|
38
|
+
http://semver.org/
|
39
|
+
|
40
|
+
* For versions name the commit after a version number, following the pattern:
|
41
|
+
|
42
|
+
VERSION 1.0.0-rc2
|
43
|
+
|
44
|
+
|
45
|
+
== Formatting:
|
46
|
+
|
47
|
+
* Use UTF-8. Declare encoding in the first line of every file.
|
48
|
+
|
49
|
+
# encoding: utf-8
|
50
|
+
|
51
|
+
* Use 2 space indent, no tabs.
|
52
|
+
|
53
|
+
* Use Unix-style line endings.
|
54
|
+
|
55
|
+
* Use spaces around operators, after commas, colons and semicolons,
|
56
|
+
around { and before }.
|
57
|
+
|
58
|
+
* No spaces after (, [ and before ], ).
|
59
|
+
|
60
|
+
* Align `when` and `else` with `case`.
|
61
|
+
|
62
|
+
* Use an empty line before the return value of a method (unless it
|
63
|
+
only has one line), and an empty line between defs.
|
64
|
+
|
65
|
+
* Use empty lines to break up a long method into logical paragraphs.
|
66
|
+
|
67
|
+
* Keep lines fewer than 80 characters.
|
68
|
+
|
69
|
+
* Strip trailing whitespace.
|
70
|
+
|
71
|
+
|
72
|
+
== Syntax:
|
73
|
+
|
74
|
+
* Write for 2.0.
|
75
|
+
|
76
|
+
* Use double quotes
|
77
|
+
|
78
|
+
http://viget.com/extend/just-use-double-quoted-ruby-strings
|
79
|
+
|
80
|
+
* Use def with parentheses when there are arguments.
|
81
|
+
|
82
|
+
* Never use for, unless you exactly know why.
|
83
|
+
|
84
|
+
* Never use then, except in case statements.
|
85
|
+
|
86
|
+
* Use when x then ... for one-line cases.
|
87
|
+
|
88
|
+
* Use &&/|| for boolean expressions, and/or for control flow. (Rule
|
89
|
+
of thumb: If you have to use outer parentheses, you are using the
|
90
|
+
wrong operators.)
|
91
|
+
|
92
|
+
* Avoid double negation (!!), unless Null Objects are expected.
|
93
|
+
|
94
|
+
http://devblog.avdi.org/2011/05/30/null-objects-and-falsiness
|
95
|
+
|
96
|
+
* Avoid multiline ?:, use if.
|
97
|
+
|
98
|
+
* Use {...} when defining blocks on one line. Use do...end for multiline
|
99
|
+
blocks.
|
100
|
+
|
101
|
+
* Avoid return where not required.
|
102
|
+
|
103
|
+
* Use ||= freely.
|
104
|
+
|
105
|
+
* Use OO regexps, and avoid =~ $0-9, $~, $` and $' when possible.
|
106
|
+
|
107
|
+
* Do not use Enumerable#inject when the "memo" object does not change between
|
108
|
+
iterations, use Enumerable#each_with_object instead (in ruby 1.9,
|
109
|
+
active_support and backports).
|
110
|
+
|
111
|
+
* Prefer ENV.fetch to ENV[] syntax.
|
112
|
+
Prefer block syntax for ENV.fetch to usage of the second argument.
|
113
|
+
|
114
|
+
|
115
|
+
== Naming:
|
116
|
+
|
117
|
+
* Use snake_case for methods.
|
118
|
+
|
119
|
+
* Use CamelCase for classes and modules. (Keep acronyms like HTTP,
|
120
|
+
RFC, XML uppercase.)
|
121
|
+
|
122
|
+
* Use SCREAMING_SNAKE_CASE for other constants.
|
123
|
+
|
124
|
+
* Do not use single letter variable names. Avoid uncommunicative names.
|
125
|
+
|
126
|
+
* Use consistent variable names. Try to keep the variable names close
|
127
|
+
to the object class name.
|
128
|
+
|
129
|
+
* Use names prefixed with _ for unused variables.
|
130
|
+
|
131
|
+
* When defining a predicate method that compares against another object of
|
132
|
+
a similar type, name the argument "other".
|
133
|
+
|
134
|
+
* Prefer map over collect, detect over find, select over find_all.
|
135
|
+
|
136
|
+
* Use def self.method to define singleton methods.
|
137
|
+
|
138
|
+
* Avoid alias when alias_method will do.
|
139
|
+
|
140
|
+
|
141
|
+
== Comments:
|
142
|
+
|
143
|
+
* Use YARD and its conventions for API documentation. Don't put an
|
144
|
+
empty line between the comment block and the def.
|
145
|
+
|
146
|
+
* Comments longer than a word are capitalized and use punctuation.
|
147
|
+
Use one space after periods.
|
148
|
+
|
149
|
+
* Avoid superfluous comments.
|
150
|
+
|
151
|
+
|
152
|
+
== Code structuring:
|
153
|
+
|
154
|
+
* Break code into packages, decoupled from the environment.
|
155
|
+
|
156
|
+
* Wrap packages into gems.
|
157
|
+
|
158
|
+
* Inject dependencies explicitly.
|
159
|
+
Leave all outer references on the border of any package. Inside
|
160
|
+
the package use internal references only.
|
161
|
+
|
162
|
+
* Follow SOLID principles.
|
163
|
+
|
164
|
+
http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)
|
165
|
+
|
166
|
+
* Only give a method one purpose for existing. If you pass in a boolean
|
167
|
+
to a method, what you're saying is that this method has two different
|
168
|
+
behaviours. Just split it into two single purpose methods. If you have
|
169
|
+
to use the words "AND" or "OR" to describe what the method does it
|
170
|
+
probably does too much.
|
171
|
+
|
172
|
+
* Avoid long methods.
|
173
|
+
Try to keep them at no more than 6 lines long, and preferably 4 or less.
|
174
|
+
|
175
|
+
If sections of a method are logically separate by blank lines, then
|
176
|
+
that's probably a sign that those sections should be split into separate
|
177
|
+
methods.
|
178
|
+
|
179
|
+
* Avoid hashes-as-optional-parameters. Does the method do too much?
|
180
|
+
|
181
|
+
* Avoid long parameter lists.
|
182
|
+
|
183
|
+
* Add "global" methods to Kernel (if you have to) and make them private.
|
184
|
+
|
185
|
+
* Use OptionParser for parsing complex command line options and
|
186
|
+
ruby -s for trivial command line options.
|
187
|
+
|
188
|
+
* Avoid needless metaprogramming.
|
189
|
+
|
190
|
+
* Always freeze objects assigned to constants.
|
191
|
+
|
192
|
+
|
193
|
+
== General:
|
194
|
+
|
195
|
+
* Code in a functional way, avoid mutation when it makes sense.
|
196
|
+
|
197
|
+
* Try to have methods either return the state of the object and have
|
198
|
+
no side effects, or return self and have side effects. This is
|
199
|
+
otherwise known as Command-query separation (CQS):
|
200
|
+
|
201
|
+
http://en.wikipedia.org/wiki/Command-query_separation
|
202
|
+
|
203
|
+
* Do not mutate arguments unless that is the purpose of the method.
|
204
|
+
|
205
|
+
* Try following TRUE heuristics by Sandi Metz
|
206
|
+
|
207
|
+
http://designisrefactoring.com/2015/02/08/introducing-sandi-metz-true/
|
208
|
+
|
209
|
+
* Do not mess around in core classes when writing libraries.
|
210
|
+
Namespace your code inside the modules, or wrap core classes to
|
211
|
+
decorators of your own.
|
212
|
+
|
213
|
+
* Do not program defensively.
|
214
|
+
|
215
|
+
http://www.erlang.se/doc/programming_rules.shtml#HDR11
|
216
|
+
|
217
|
+
* Keep the code simple.
|
218
|
+
|
219
|
+
* Don't overdesign.
|
220
|
+
|
221
|
+
* Don't underdesign.
|
222
|
+
|
223
|
+
* Avoid bugs.
|
224
|
+
|
225
|
+
* Read other style guides and apply the parts that don't dissent with
|
226
|
+
this list.
|
227
|
+
|
228
|
+
* Be consistent.
|
229
|
+
|
230
|
+
* Use common sense.
|