skunk 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,10 +5,10 @@ require "rubycritic/core/analysed_modules_collection"
5
5
  module RubyCritic
6
6
  # nodoc #
7
7
  class AnalysedModulesCollection
8
- def stink_score_average
8
+ def skunk_score_average
9
9
  num_modules = @modules.size
10
10
  if num_modules.positive?
11
- map(&:stink_score).reduce(:+) / num_modules.to_f
11
+ sum(&:skunk_score) / num_modules.to_f
12
12
  else
13
13
  0.0
14
14
  end
data/lib/skunk/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Skunk
4
- VERSION = "0.4.2"
4
+ VERSION = "0.5.0"
5
5
  end
data/logo.png ADDED
Binary file
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ def hello
4
+ puts "hello world"
5
+ end
@@ -3,34 +3,34 @@
3
3
  require "rubycritic/core/analysed_module"
4
4
 
5
5
  module RubyCritic
6
- # Monkey-patches RubyCritic::AnalysedModule to add a stink_score method
6
+ # Monkey-patches RubyCritic::AnalysedModule to add a skunk_score method
7
7
  class AnalysedModule
8
8
  PERFECT_COVERAGE = 100
9
9
 
10
- # Returns a numeric value that represents the stink_score of a module:
10
+ # Returns a numeric value that represents the skunk_score of a module:
11
11
  #
12
- # If module is perfectly covered, stink score is the same as the
12
+ # If module is perfectly covered, skunk score is the same as the
13
13
  # `churn_times_cost`
14
14
  #
15
- # If module has no coverage, stink score is a penalized value of
15
+ # If module has no coverage, skunk score is a penalized value of
16
16
  # `churn_times_cost`
17
17
  #
18
- # For now the stink_score is calculated by multiplying `churn_times_cost`
18
+ # For now the skunk_score is calculated by multiplying `churn_times_cost`
19
19
  # times the lack of coverage.
20
20
  #
21
21
  # For example:
22
22
  #
23
23
  # When `churn_times_cost` is 100 and module is perfectly covered:
24
- # stink_score => 100
24
+ # skunk_score => 100
25
25
  #
26
26
  # When `churn_times_cost` is 100 and module is not covered at all:
27
- # stink_score => 100 * 100 = 10_000
27
+ # skunk_score => 100 * 100 = 10_000
28
28
  #
29
29
  # When `churn_times_cost` is 100 and module is covered at 75%:
30
- # stink_score => 100 * 25 (percentage uncovered) = 2_500
30
+ # skunk_score => 100 * 25 (percentage uncovered) = 2_500
31
31
  #
32
32
  # @return [Float]
33
- def stink_score
33
+ def skunk_score
34
34
  return cost.round(2) if coverage == PERFECT_COVERAGE
35
35
 
36
36
  (cost * (PERFECT_COVERAGE - coverage.to_i)).round(2)
data/skunk.gemspec CHANGED
@@ -11,9 +11,11 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ["ernesto+github@ombulabs.com"]
12
12
  spec.licenses = ["MIT"]
13
13
  spec.summary = "A library to assess code quality vs. code coverage"
14
- spec.description = "Knows how to calculate the StinkScore for a Ruby file"
14
+ spec.description = "Knows how to calculate the SkunkScore for a set of Ruby modules"
15
15
  spec.homepage = "https://github.com/fastruby/skunk"
16
16
 
17
+ spec.required_ruby_version = [">= 2.4.0", "< 3.1.0"]
18
+
17
19
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
20
  # to allow pushing to a single host or delete this section to allow pushing to any host.
19
21
  if spec.respond_to?(:metadata)
@@ -36,16 +38,20 @@ Gem::Specification.new do |spec|
36
38
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
39
  spec.require_paths = ["lib"]
38
40
 
39
- spec.add_dependency "rubycritic", "~> 4.0"
41
+ spec.add_dependency "rubycritic", ">= 4.5.2", "< 5.0"
40
42
  spec.add_dependency "terminal-table", "~> 1.8.0"
41
43
 
42
- spec.add_development_dependency "bundler", "~> 2.0"
43
44
  spec.add_development_dependency "byebug", "~> 11"
45
+ spec.add_development_dependency "codecov", "~> 0.1.16"
44
46
  spec.add_development_dependency "minitest", "~> 5.8.4"
45
47
  spec.add_development_dependency "minitest-around", "~> 0.5.0"
46
- spec.add_development_dependency "rake", "~> 10.0"
47
- spec.add_development_dependency "reek", "~> 5.4.0"
48
- spec.add_development_dependency "rubocop", "< 1.0"
49
- spec.add_development_dependency "simplecov", "~> 0.17.1"
48
+ spec.add_development_dependency "minitest-stub_any_instance", "~> 1.0.2"
49
+ spec.add_development_dependency "minitest-stub-const", "~> 0.6"
50
+ spec.add_development_dependency "rake", "~> 13.0"
51
+ spec.add_development_dependency "reek", "~> 6.0.0"
52
+ spec.add_development_dependency "rubocop", "~> 1.0"
53
+ spec.add_development_dependency "simplecov", "~> 0.18"
50
54
  spec.add_development_dependency "simplecov-console", "0.5.0"
55
+ spec.add_development_dependency "vcr", "~> 6.0.0"
56
+ spec.add_development_dependency "webmock", "~> 3.10.0"
51
57
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skunk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernesto Tagwerker
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-09 00:00:00.000000000 Z
11
+ date: 2021-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubycritic
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.5.2
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '4.0'
22
+ version: '5.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '4.0'
29
+ version: 4.5.2
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: terminal-table
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -39,33 +45,33 @@ dependencies:
39
45
  - !ruby/object:Gem::Version
40
46
  version: 1.8.0
41
47
  - !ruby/object:Gem::Dependency
42
- name: bundler
48
+ name: byebug
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '2.0'
53
+ version: '11'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '2.0'
60
+ version: '11'
55
61
  - !ruby/object:Gem::Dependency
56
- name: byebug
62
+ name: codecov
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
- version: '11'
67
+ version: 0.1.16
62
68
  type: :development
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
- version: '11'
74
+ version: 0.1.16
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: minitest
71
77
  requirement: !ruby/object:Gem::Requirement
@@ -94,46 +100,74 @@ dependencies:
94
100
  - - "~>"
95
101
  - !ruby/object:Gem::Version
96
102
  version: 0.5.0
103
+ - !ruby/object:Gem::Dependency
104
+ name: minitest-stub_any_instance
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 1.0.2
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: 1.0.2
117
+ - !ruby/object:Gem::Dependency
118
+ name: minitest-stub-const
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.6'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '0.6'
97
131
  - !ruby/object:Gem::Dependency
98
132
  name: rake
99
133
  requirement: !ruby/object:Gem::Requirement
100
134
  requirements:
101
135
  - - "~>"
102
136
  - !ruby/object:Gem::Version
103
- version: '10.0'
137
+ version: '13.0'
104
138
  type: :development
105
139
  prerelease: false
106
140
  version_requirements: !ruby/object:Gem::Requirement
107
141
  requirements:
108
142
  - - "~>"
109
143
  - !ruby/object:Gem::Version
110
- version: '10.0'
144
+ version: '13.0'
111
145
  - !ruby/object:Gem::Dependency
112
146
  name: reek
113
147
  requirement: !ruby/object:Gem::Requirement
114
148
  requirements:
115
149
  - - "~>"
116
150
  - !ruby/object:Gem::Version
117
- version: 5.4.0
151
+ version: 6.0.0
118
152
  type: :development
119
153
  prerelease: false
120
154
  version_requirements: !ruby/object:Gem::Requirement
121
155
  requirements:
122
156
  - - "~>"
123
157
  - !ruby/object:Gem::Version
124
- version: 5.4.0
158
+ version: 6.0.0
125
159
  - !ruby/object:Gem::Dependency
126
160
  name: rubocop
127
161
  requirement: !ruby/object:Gem::Requirement
128
162
  requirements:
129
- - - "<"
163
+ - - "~>"
130
164
  - !ruby/object:Gem::Version
131
165
  version: '1.0'
132
166
  type: :development
133
167
  prerelease: false
134
168
  version_requirements: !ruby/object:Gem::Requirement
135
169
  requirements:
136
- - - "<"
170
+ - - "~>"
137
171
  - !ruby/object:Gem::Version
138
172
  version: '1.0'
139
173
  - !ruby/object:Gem::Dependency
@@ -142,14 +176,14 @@ dependencies:
142
176
  requirements:
143
177
  - - "~>"
144
178
  - !ruby/object:Gem::Version
145
- version: 0.17.1
179
+ version: '0.18'
146
180
  type: :development
147
181
  prerelease: false
148
182
  version_requirements: !ruby/object:Gem::Requirement
149
183
  requirements:
150
184
  - - "~>"
151
185
  - !ruby/object:Gem::Version
152
- version: 0.17.1
186
+ version: '0.18'
153
187
  - !ruby/object:Gem::Dependency
154
188
  name: simplecov-console
155
189
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +198,35 @@ dependencies:
164
198
  - - '='
165
199
  - !ruby/object:Gem::Version
166
200
  version: 0.5.0
167
- description: Knows how to calculate the StinkScore for a Ruby file
201
+ - !ruby/object:Gem::Dependency
202
+ name: vcr
203
+ requirement: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: 6.0.0
208
+ type: :development
209
+ prerelease: false
210
+ version_requirements: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - "~>"
213
+ - !ruby/object:Gem::Version
214
+ version: 6.0.0
215
+ - !ruby/object:Gem::Dependency
216
+ name: webmock
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - "~>"
220
+ - !ruby/object:Gem::Version
221
+ version: 3.10.0
222
+ type: :development
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - "~>"
227
+ - !ruby/object:Gem::Version
228
+ version: 3.10.0
229
+ description: Knows how to calculate the SkunkScore for a set of Ruby modules
168
230
  email:
169
231
  - ernesto+github@ombulabs.com
170
232
  executables:
@@ -172,36 +234,43 @@ executables:
172
234
  extensions: []
173
235
  extra_rdoc_files: []
174
236
  files:
237
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
238
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
175
239
  - ".github/workflows/main.yml"
176
240
  - ".github/workflows/skunk.yml"
177
241
  - ".gitignore"
178
242
  - ".reek.yml"
179
243
  - ".rubocop.yml"
180
244
  - ".rubocop_todo.yml"
181
- - ".travis.yml"
182
245
  - CHANGELOG.md
246
+ - CODEOWNERS
183
247
  - CODE_OF_CONDUCT.md
184
248
  - Gemfile
185
- - Gemfile.lock
249
+ - Gemfile-Ruby-2-4
186
250
  - LICENSE.txt
187
251
  - README.md
188
252
  - Rakefile
189
253
  - exe/skunk
254
+ - fastruby-logo.png
190
255
  - lib/skunk.rb
191
256
  - lib/skunk/cli/application.rb
192
257
  - lib/skunk/cli/command_factory.rb
193
258
  - lib/skunk/cli/commands/base.rb
194
259
  - lib/skunk/cli/commands/compare.rb
260
+ - lib/skunk/cli/commands/compare_score.rb
195
261
  - lib/skunk/cli/commands/default.rb
196
262
  - lib/skunk/cli/commands/help.rb
197
263
  - lib/skunk/cli/commands/output.rb
198
264
  - lib/skunk/cli/commands/status_reporter.rb
265
+ - lib/skunk/cli/commands/status_sharer.rb
199
266
  - lib/skunk/cli/commands/version.rb
200
267
  - lib/skunk/cli/options.rb
201
268
  - lib/skunk/cli/options/argv.rb
202
269
  - lib/skunk/rubycritic/analysed_module.rb
203
270
  - lib/skunk/rubycritic/analysed_modules_collection.rb
204
271
  - lib/skunk/version.rb
272
+ - logo.png
273
+ - samples/engines/spec/nested_sample_spec.rb
205
274
  - samples/rubycritic/analysed_module.rb
206
275
  - skunk.gemspec
207
276
  homepage: https://github.com/fastruby/skunk
@@ -212,7 +281,7 @@ metadata:
212
281
  homepage_uri: https://github.com/fastruby/skunk
213
282
  source_code_uri: https://github.com/fastruby/skunk
214
283
  changelog_uri: https://github.com/fastruby/skunk/changelog
215
- post_install_message:
284
+ post_install_message:
216
285
  rdoc_options: []
217
286
  require_paths:
218
287
  - lib
@@ -220,15 +289,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
220
289
  requirements:
221
290
  - - ">="
222
291
  - !ruby/object:Gem::Version
223
- version: '0'
292
+ version: 2.4.0
293
+ - - "<"
294
+ - !ruby/object:Gem::Version
295
+ version: 3.1.0
224
296
  required_rubygems_version: !ruby/object:Gem::Requirement
225
297
  requirements:
226
298
  - - ">="
227
299
  - !ruby/object:Gem::Version
228
300
  version: '0'
229
301
  requirements: []
230
- rubygems_version: 3.0.6
231
- signing_key:
302
+ rubygems_version: 3.2.3
303
+ signing_key:
232
304
  specification_version: 4
233
305
  summary: A library to assess code quality vs. code coverage
234
306
  test_files: []
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.5
4
- - 2.6
5
- - 2.7
data/Gemfile.lock DELETED
@@ -1,119 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- skunk (0.4.2)
5
- rubycritic (~> 4.0)
6
- terminal-table (~> 1.8.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- addressable (2.7.0)
12
- public_suffix (>= 2.0.2, < 5.0)
13
- ansi (1.5.0)
14
- ast (2.4.0)
15
- axiom-types (0.1.1)
16
- descendants_tracker (~> 0.0.4)
17
- ice_nine (~> 0.11.0)
18
- thread_safe (~> 0.3, >= 0.3.1)
19
- byebug (11.0.1)
20
- codeclimate-engine-rb (0.4.1)
21
- virtus (~> 1.0)
22
- coercible (1.0.0)
23
- descendants_tracker (~> 0.0.1)
24
- descendants_tracker (0.0.4)
25
- thread_safe (~> 0.3, >= 0.3.1)
26
- docile (1.3.2)
27
- equalizer (0.0.11)
28
- erubis (2.7.0)
29
- flay (2.12.1)
30
- erubis (~> 2.7.0)
31
- path_expander (~> 1.0)
32
- ruby_parser (~> 3.0)
33
- sexp_processor (~> 4.0)
34
- flog (4.6.4)
35
- path_expander (~> 1.0)
36
- ruby_parser (~> 3.1, > 3.1.0)
37
- sexp_processor (~> 4.8)
38
- ice_nine (0.11.2)
39
- jaro_winkler (1.5.4)
40
- json (2.2.0)
41
- kwalify (0.7.2)
42
- launchy (2.4.3)
43
- addressable (~> 2.3)
44
- minitest (5.8.5)
45
- minitest-around (0.5.0)
46
- minitest (~> 5.0)
47
- parallel (1.19.0)
48
- parser (2.6.5.0)
49
- ast (~> 2.4.0)
50
- path_expander (1.1.0)
51
- psych (3.1.0)
52
- public_suffix (4.0.3)
53
- rainbow (3.0.0)
54
- rake (10.5.0)
55
- reek (5.4.1)
56
- codeclimate-engine-rb (~> 0.4.0)
57
- kwalify (~> 0.7.0)
58
- parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
59
- psych (~> 3.1.0)
60
- rainbow (>= 2.0, < 4.0)
61
- rubocop (0.76.0)
62
- jaro_winkler (~> 1.5.1)
63
- parallel (~> 1.10)
64
- parser (>= 2.6)
65
- rainbow (>= 2.2.2, < 4.0)
66
- ruby-progressbar (~> 1.7)
67
- unicode-display_width (>= 1.4.0, < 1.7)
68
- ruby-progressbar (1.10.1)
69
- ruby_parser (3.14.2)
70
- sexp_processor (~> 4.9)
71
- rubycritic (4.3.3)
72
- flay (~> 2.8)
73
- flog (~> 4.4)
74
- launchy (= 2.4.3)
75
- parser (>= 2.6.0)
76
- rainbow (~> 3.0)
77
- reek (~> 5.0, < 6.0)
78
- ruby_parser (~> 3.8)
79
- simplecov (>= 0.17.0)
80
- tty-which (~> 0.4.0)
81
- virtus (~> 1.0)
82
- sexp_processor (4.14.0)
83
- simplecov (0.17.1)
84
- docile (~> 1.1)
85
- json (>= 1.8, < 3)
86
- simplecov-html (~> 0.10.0)
87
- simplecov-console (0.5.0)
88
- ansi
89
- simplecov
90
- terminal-table
91
- simplecov-html (0.10.2)
92
- terminal-table (1.8.0)
93
- unicode-display_width (~> 1.1, >= 1.1.1)
94
- thread_safe (0.3.6)
95
- tty-which (0.4.2)
96
- unicode-display_width (1.6.0)
97
- virtus (1.0.5)
98
- axiom-types (~> 0.1)
99
- coercible (~> 1.0)
100
- descendants_tracker (~> 0.0, >= 0.0.3)
101
- equalizer (~> 0.0, >= 0.0.9)
102
-
103
- PLATFORMS
104
- ruby
105
-
106
- DEPENDENCIES
107
- bundler (~> 2.0)
108
- byebug (~> 11)
109
- minitest (~> 5.8.4)
110
- minitest-around (~> 0.5.0)
111
- rake (~> 10.0)
112
- reek (~> 5.4.0)
113
- rubocop (< 1.0)
114
- simplecov (~> 0.17.1)
115
- simplecov-console (= 0.5.0)
116
- skunk!
117
-
118
- BUNDLED WITH
119
- 2.0.2