feature_map 1.2.9 → 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/lib/feature_map/private/assignments_file.rb +2 -2
- data/lib/feature_map/private/docs/index.html +76 -253
- data/lib/feature_map/private/feature_metrics_calculator.rb +2 -2
- data/lib/feature_map/private/test_pyramid/jest_mapper.rb +2 -2
- data/lib/feature_map/private/test_pyramid_file.rb +3 -3
- data/lib/feature_map.rb +6 -3
- metadata +1 -1
|
@@ -24,8 +24,8 @@ module FeatureMap
|
|
|
24
24
|
metrics = file_paths.map { |file| calculate_for_file(file) }
|
|
25
25
|
|
|
26
26
|
# Handle numeric metrics
|
|
27
|
-
aggregate_metrics = [ABC_SIZE_METRIC, CYCLOMATIC_COMPLEXITY_METRIC, LINES_OF_CODE_METRIC].
|
|
28
|
-
|
|
27
|
+
aggregate_metrics = [ABC_SIZE_METRIC, CYCLOMATIC_COMPLEXITY_METRIC, LINES_OF_CODE_METRIC].to_h do |metric_key|
|
|
28
|
+
[metric_key, metrics.sum { |m| m[metric_key] || 0 }]
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# Handle additional supported metrics
|
|
@@ -5,8 +5,8 @@ module FeatureMap
|
|
|
5
5
|
class << self
|
|
6
6
|
def map_tests_by_assignment(test_suites, assignments)
|
|
7
7
|
# Transform test suites into a hash of filepath => assertion results
|
|
8
|
-
tests_by_path = test_suites.
|
|
9
|
-
|
|
8
|
+
tests_by_path = test_suites.to_h do |suite|
|
|
9
|
+
[filepath(suite['name']), suite['assertionResults']]
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
assignments.each_with_object({}) do |(feature_name, files), result|
|
|
@@ -38,15 +38,15 @@ module FeatureMap
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def self.generate_content(unit_by_feature, integration_by_feature, regression_by_feature)
|
|
41
|
-
CodeFeatures.all.map(&:name).
|
|
42
|
-
|
|
41
|
+
CodeFeatures.all.map(&:name).to_h do |feature_name|
|
|
42
|
+
[feature_name, {
|
|
43
43
|
'unit_count' => unit_by_feature.dig(feature_name, :count) || 0,
|
|
44
44
|
'unit_pending' => unit_by_feature.dig(feature_name, :pending) || 0,
|
|
45
45
|
'integration_count' => integration_by_feature.dig(feature_name, :count) || 0,
|
|
46
46
|
'integration_pending' => integration_by_feature.dig(feature_name, :pending) || 0,
|
|
47
47
|
'regression_count' => regression_by_feature.dig(feature_name, :count) || 0,
|
|
48
48
|
'regression_pending' => regression_by_feature.dig(feature_name, :pending) || 0
|
|
49
|
-
}
|
|
49
|
+
}]
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
data/lib/feature_map.rb
CHANGED
|
@@ -137,12 +137,15 @@ module FeatureMap
|
|
|
137
137
|
#
|
|
138
138
|
# ./app/controllers/some_controller.rb:43:in `block (3 levels) in create'
|
|
139
139
|
#
|
|
140
|
+
# Ruby 3.4 changed the opening quote around the function name from a
|
|
141
|
+
# backtick to a single quote (`block ...'` -> `'block ...'`), so both
|
|
142
|
+
# delimiters are matched to remain compatible across Ruby versions.
|
|
140
143
|
backtrace_line = %r{\A(#{Pathname.pwd}/|\./)?
|
|
141
|
-
(?<file>.+)
|
|
144
|
+
(?<file>.+) # Matches 'app/controllers/some_controller.rb'
|
|
142
145
|
:
|
|
143
|
-
(?<line>\d+)
|
|
146
|
+
(?<line>\d+) # Matches '43'
|
|
144
147
|
:in\s
|
|
145
|
-
`(?<function>.*)' # Matches "`block (3 levels) in create'"
|
|
148
|
+
[`'](?<function>.*)' # Matches "`block (3 levels) in create'" or "'block (3 levels) in create'"
|
|
146
149
|
\z}x
|
|
147
150
|
|
|
148
151
|
backtrace.lazy.filter_map do |line|
|