File tree Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
## main [ (unreleased)] ( https://github.com/fastruby/skunk/compare/v0.5.2...HEAD )
9
9
10
10
* <INSERT YOUR FEATURE OR BUGFIX HERE >
11
+ * [ BUGFIX: Fix documentation and refactor ` skunk_score ` method] ( https://github.com/fastruby/skunk/pull/102 )
11
12
* [ FEATURE: Improve main workflow] ( https://github.com/fastruby/skunk/pull/99 )
12
13
* [ BUGFIX: Fix analized module test] ( https://github.com/fastruby/skunk/pull/98 )
13
14
Original file line number Diff line number Diff line change @@ -10,30 +10,38 @@ class AnalysedModule
10
10
# Returns a numeric value that represents the skunk_score of a module:
11
11
#
12
12
# If module is perfectly covered, skunk score is the same as the
13
- # `churn_times_cost `
13
+ # `cost `
14
14
#
15
15
# If module has no coverage, skunk score is a penalized value of
16
- # `churn_times_cost `
16
+ # `cost `
17
17
#
18
- # For now the skunk_score is calculated by multiplying `churn_times_cost `
18
+ # For now the skunk_score is calculated by multiplying `cost `
19
19
# times the lack of coverage.
20
20
#
21
21
# For example:
22
22
#
23
- # When `churn_times_cost ` is 100 and module is perfectly covered:
23
+ # When `cost ` is 100 and module is perfectly covered:
24
24
# skunk_score => 100
25
25
#
26
- # When `churn_times_cost ` is 100 and module is not covered at all:
26
+ # When `cost ` is 100 and module is not covered at all:
27
27
# skunk_score => 100 * 100 = 10_000
28
28
#
29
- # When `churn_times_cost ` is 100 and module is covered at 75%:
29
+ # When `cost ` is 100 and module is covered at 75%:
30
30
# skunk_score => 100 * 25 (percentage uncovered) = 2_500
31
31
#
32
32
# @return [Float]
33
33
def skunk_score
34
34
return cost . round ( 2 ) if coverage == PERFECT_COVERAGE
35
35
36
- ( cost * ( PERFECT_COVERAGE - coverage . to_i ) ) . round ( 2 )
36
+ ( cost * penalty_factor ) . round ( 2 )
37
+ end
38
+
39
+ # Returns a numeric value that represents the penalty factor based
40
+ # on the lack of code coverage (not enough test cases for this module)
41
+ #
42
+ # @return [Integer]
43
+ def penalty_factor
44
+ PERFECT_COVERAGE - coverage . to_i
37
45
end
38
46
39
47
# Returns the value of churn times cost.
Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ Gem::Specification.new do |spec|
41
41
spec . add_dependency "rubycritic" , ">= 4.5.2" , "< 5.0"
42
42
spec . add_dependency "terminal-table" , "~> 1.8.0"
43
43
44
- spec . add_development_dependency "byebug" , "~> 11"
45
44
spec . add_development_dependency "codecov" , "~> 0.1.16"
45
+ spec . add_development_dependency "debug"
46
46
spec . add_development_dependency "minitest" , "~> 5.8.4"
47
47
spec . add_development_dependency "minitest-around" , "~> 0.5.0"
48
48
spec . add_development_dependency "minitest-stub_any_instance" , "~> 1.0.2"
You can’t perform that action at this time.
0 commit comments