overrides_tracker 0.2.3 → 0.3.1
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/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +23 -118
- data/bin/overrides_tracker +1 -0
- data/lib/external/require_all.rb +5 -2
- data/lib/html/assets/fonts/RedHatText-Italic-VariableFont_wght.ttf +0 -0
- data/lib/html/assets/fonts/RedHatText-VariableFont_wght.ttf +0 -0
- data/lib/html/assets/fonts/materialdesignicons-webfont.eot +0 -0
- data/lib/html/assets/fonts/materialdesignicons-webfont.ttf +0 -0
- data/lib/html/assets/fonts/materialdesignicons-webfont.woff +0 -0
- data/lib/html/assets/fonts/materialdesignicons-webfont.woff2 +0 -0
- data/lib/html/assets/logo/android-chrome-192x192.png +0 -0
- data/lib/html/assets/logo/android-chrome-512x512.png +0 -0
- data/lib/html/assets/logo/apple-touch-icon.png +0 -0
- data/lib/html/assets/logo/browserconfig.xml +9 -0
- data/lib/html/assets/logo/favicon-16x16.png +0 -0
- data/lib/html/assets/logo/favicon-32x32.png +0 -0
- data/lib/html/assets/logo/favicon.ico +0 -0
- data/lib/html/assets/logo/icon.png +0 -0
- data/lib/html/assets/logo/logo.svg +3 -0
- data/lib/html/assets/logo/mstile-150x150.png +0 -0
- data/lib/html/assets/logo/safari-pinned-tab.svg +58 -0
- data/lib/html/assets/logo/site.webmanifest +19 -0
- data/lib/html/assets/logo.svg +3 -0
- data/lib/html/assets/materialdesignicons.css +25 -0
- data/lib/html/assets/script.js +64 -0
- data/lib/html/assets/style.css +104 -0
- data/lib/html/compare.html +115 -0
- data/lib/html/summary.html +155 -0
- data/lib/overrides_tracker/comparer.rb +137 -19
- data/lib/overrides_tracker/methods_collector.rb +149 -1
- data/lib/overrides_tracker/version.rb +1 -1
- data/overrides_tracker/assets/fonts/RedHatText-Italic-VariableFont_wght.ttf +0 -0
- data/overrides_tracker/assets/fonts/RedHatText-VariableFont_wght.ttf +0 -0
- data/overrides_tracker/assets/fonts/materialdesignicons-webfont.eot +0 -0
- data/overrides_tracker/assets/fonts/materialdesignicons-webfont.ttf +0 -0
- data/overrides_tracker/assets/fonts/materialdesignicons-webfont.woff +0 -0
- data/overrides_tracker/assets/fonts/materialdesignicons-webfont.woff2 +0 -0
- data/overrides_tracker/assets/logo/android-chrome-192x192.png +0 -0
- data/overrides_tracker/assets/logo/android-chrome-512x512.png +0 -0
- data/overrides_tracker/assets/logo/apple-touch-icon.png +0 -0
- data/overrides_tracker/assets/logo/browserconfig.xml +9 -0
- data/overrides_tracker/assets/logo/favicon-16x16.png +0 -0
- data/overrides_tracker/assets/logo/favicon-32x32.png +0 -0
- data/overrides_tracker/assets/logo/favicon.ico +0 -0
- data/overrides_tracker/assets/logo/icon.png +0 -0
- data/overrides_tracker/assets/logo/logo.svg +3 -0
- data/overrides_tracker/assets/logo/mstile-150x150.png +0 -0
- data/overrides_tracker/assets/logo/safari-pinned-tab.svg +58 -0
- data/overrides_tracker/assets/logo/site.webmanifest +19 -0
- data/overrides_tracker/assets/logo.svg +3 -0
- data/overrides_tracker/assets/materialdesignicons.css +25 -0
- data/overrides_tracker/assets/script.js +64 -0
- data/overrides_tracker/assets/style.css +104 -0
- data/overrides_tracker/branch_name#last_commit_id.otf +1 -1
- data/overrides_tracker/compare.html +115 -0
- data/overrides_tracker/summary.html +173 -0
- data/spec/overrides_tracker/methods_collector_spec.rb +27 -0
- metadata +50 -2
@@ -0,0 +1,115 @@
|
|
1
|
+
<html>
|
2
|
+
|
3
|
+
<head>
|
4
|
+
<title>Overrides</title>
|
5
|
+
<meta content="width=device-width,initial-scale=1" name="viewport">
|
6
|
+
<link href="./assets/logo/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180">
|
7
|
+
<link href="./assets/logo/favicon-32x32.png" rel="icon" sizes="32x32" type="image/png">
|
8
|
+
<link href="./assets/logo/favicon-16x16.png" rel="icon" sizes="16x16" type="image/png">
|
9
|
+
<link color="#5bbad5" href="./assets/logo/safari-pinned-tab.svg" rel="mask-icon">
|
10
|
+
<script src="https://code.jquery.com/jquery-3.6.3.min.js"
|
11
|
+
integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
|
12
|
+
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.10/dist/clipboard.min.js"></script>
|
13
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
|
14
|
+
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
|
15
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
|
16
|
+
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
|
17
|
+
crossorigin="anonymous"></script>
|
18
|
+
<script src="./assets/script.js"></script>
|
19
|
+
<link href="./assets/style.css" rel="stylesheet">
|
20
|
+
<link href="./assets/materialdesignicons.css" rel="stylesheet">
|
21
|
+
<meta content="#da532c" name="msapplication-TileColor">
|
22
|
+
<meta content="#F2D51E" name="theme-color">
|
23
|
+
</head>
|
24
|
+
|
25
|
+
<body>
|
26
|
+
<div class="navigation">
|
27
|
+
<div class="container">
|
28
|
+
<nav class="navbar navbar-expand-lg d-flex justify-content-between">
|
29
|
+
<div class="ml-3 logo">
|
30
|
+
<a href="https://www.overrides.io" target="_blank">
|
31
|
+
<img alt="overrides Logo" src="./assets/logo.svg" height="50">
|
32
|
+
</a>
|
33
|
+
</div>
|
34
|
+
<a href="https://www.overrides.io/continuous_integration" target="_blank" class="btn btn-primary">Integrate Overrides into your CI/CD pipeline</a>
|
35
|
+
</nav>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="content-wrapper" style="min-height: 806px;">
|
40
|
+
<div class="section builds bg-yellow text-dark py-3">
|
41
|
+
<div class="container">
|
42
|
+
<h2 class="text-dark">
|
43
|
+
Compare
|
44
|
+
</h1>
|
45
|
+
<div class="row">
|
46
|
+
<!--FILENAMES-->
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
<div class="section py-3">
|
51
|
+
<div class="container">
|
52
|
+
<div class="scrollbox">
|
53
|
+
<ul class="nav nav-tabs mt-5">
|
54
|
+
<li class="nav-item">
|
55
|
+
<a class="nav-link active" type="button" data-bs-toggle="collapse"
|
56
|
+
data-bs-target="#overrides_inside_code_base" aria-expanded="true"
|
57
|
+
aria-controls="panelsStayOpen-collapseOne">
|
58
|
+
Overrides inside codebase
|
59
|
+
(<!--NUMBER_OF_OVERRIDES_INSIDE-->)
|
60
|
+
</a>
|
61
|
+
</li>
|
62
|
+
<li class="nav-item">
|
63
|
+
<a class="nav-link" type="button" data-bs-toggle="collapse" data-bs-target="#added_methods_inside_code_base"
|
64
|
+
aria-expanded="false" aria-controls="panelsStayOpen-collapseTwo">
|
65
|
+
Added methods inside codebase
|
66
|
+
(<!--NUMBER_OF_ADDED_METHODS-->)
|
67
|
+
</a>
|
68
|
+
</li>
|
69
|
+
<li class="nav-item">
|
70
|
+
<a class="nav-link" type="button" data-bs-toggle="collapse" data-bs-target="#overrides_outside_code_base"
|
71
|
+
aria-expanded="false" aria-controls="panelsStayOpen-collapseThree">
|
72
|
+
Overrides outside codebase
|
73
|
+
(<!--NUMBER_OF_OVERRIDES_OUTSIDE-->)
|
74
|
+
</a>
|
75
|
+
</li>
|
76
|
+
</ul>
|
77
|
+
<div class="accordion accordion-flush" id="accordionFlushExample">
|
78
|
+
<div class="accordion-item">
|
79
|
+
<div id="overrides_inside_code_base" class="accordion-collapse collapse show"
|
80
|
+
aria-labelledby="flush-headingOne" data-bs-parent="#accordionFlushExample">
|
81
|
+
<div class="accordion-body">
|
82
|
+
<div class="pt-5">
|
83
|
+
<!--OVERRIDES_INSIDE_CODEBASE-->
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
<div class="accordion-item">
|
89
|
+
<div id="added_methods_inside_code_base" class="accordion-collapse collapse"
|
90
|
+
aria-labelledby="flush-headingTwo" data-bs-parent="#accordionFlushExample">
|
91
|
+
<div class="accordion-body">
|
92
|
+
<div class="pt-5">
|
93
|
+
<!--ADDED_METHODS_INSIDE_CODEBASE-->
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="accordion-item">
|
99
|
+
<div id="overrides_outside_code_base" class="accordion-collapse collapse"
|
100
|
+
aria-labelledby="flush-headingThree" data-bs-parent="#accordionFlushExample">
|
101
|
+
<div class="accordion-body">
|
102
|
+
<div class="pt-5">
|
103
|
+
<!--OVERRIDES_OUTSIDE_CODEBASE-->
|
104
|
+
</div>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
</body>
|
114
|
+
|
115
|
+
</html>
|
@@ -0,0 +1,155 @@
|
|
1
|
+
<html>
|
2
|
+
|
3
|
+
<head>
|
4
|
+
<title>Overrides</title>
|
5
|
+
<meta content="width=device-width,initial-scale=1" name="viewport">
|
6
|
+
<link href="./assets/logo/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180">
|
7
|
+
<link href="./assets/logo/favicon-32x32.png" rel="icon" sizes="32x32" type="image/png">
|
8
|
+
<link href="./assets/logo/favicon-16x16.png" rel="icon" sizes="16x16" type="image/png">
|
9
|
+
<link color="#5bbad5" href="./assets/logo/safari-pinned-tab.svg" rel="mask-icon">
|
10
|
+
<script src="https://code.jquery.com/jquery-3.6.3.min.js"
|
11
|
+
integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
|
12
|
+
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.10/dist/clipboard.min.js"></script>
|
13
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
|
14
|
+
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
|
15
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
|
16
|
+
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
|
17
|
+
crossorigin="anonymous"></script>
|
18
|
+
<script src="./assets/script.js"></script>
|
19
|
+
<link href="./assets/style.css" rel="stylesheet">
|
20
|
+
<link href="./assets/materialdesignicons.css" rel="stylesheet">
|
21
|
+
<meta content="#da532c" name="msapplication-TileColor">
|
22
|
+
<meta content="#F2D51E" name="theme-color">
|
23
|
+
</head>
|
24
|
+
|
25
|
+
<body>
|
26
|
+
<div class="navigation">
|
27
|
+
<div class="container">
|
28
|
+
<nav class="navbar navbar-expand-lg d-flex justify-content-between">
|
29
|
+
<div class="ml-3 logo">
|
30
|
+
<a href="https://www.overrides.io" target="_blank">
|
31
|
+
<img alt="overrides Logo" src="./assets/logo.svg" height="50">
|
32
|
+
</a>
|
33
|
+
</div>
|
34
|
+
<a href="https://www.overrides.io/continuous_integration" target="_blank" class="btn btn-primary">Integrate Overrides into your CI/CD pipeline</a>
|
35
|
+
</nav>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="content-wrapper" style="min-height: 806px;">
|
40
|
+
<div class="section py-3">
|
41
|
+
<div class="container">
|
42
|
+
<h1>
|
43
|
+
<!--LAST_COMMIT_NAME-->
|
44
|
+
</h1>
|
45
|
+
<div class="row">
|
46
|
+
<div class="col-12 col-md-6">
|
47
|
+
<p>
|
48
|
+
Commit subject:
|
49
|
+
<!--BRANCH_NAME-->/<!--LAST_COMMIT_NAME-->
|
50
|
+
</p>
|
51
|
+
<p class="text-muted">
|
52
|
+
Date:
|
53
|
+
<!--DATE-->
|
54
|
+
</p>
|
55
|
+
</div>
|
56
|
+
<div class="col-12 col-md-6">
|
57
|
+
<div class="card">
|
58
|
+
<div class="card-body">
|
59
|
+
<h6>
|
60
|
+
Results:
|
61
|
+
</h6>
|
62
|
+
<p>
|
63
|
+
<b>
|
64
|
+
# Overrides:
|
65
|
+
</b>
|
66
|
+
<!--NUMBER_OF_OVERRIDES_INSIDE-->
|
67
|
+
|
|
68
|
+
<!--NUMBER_OF_OVERRIDES_OUTSIDE-->
|
69
|
+
<br>
|
70
|
+
<b>
|
71
|
+
# Added methods to classes:
|
72
|
+
</b>
|
73
|
+
<!--NUMBER_OF_ADDED_METHODS-->
|
74
|
+
</p>
|
75
|
+
<hr>
|
76
|
+
<h6>
|
77
|
+
Investigated:
|
78
|
+
</h6>
|
79
|
+
<p class="text-muted">
|
80
|
+
<b>
|
81
|
+
# Classes:
|
82
|
+
</b>
|
83
|
+
<!--NUMBER_OF_CLASSES_INVESTIGATED-->
|
84
|
+
<br>
|
85
|
+
<b>
|
86
|
+
# Methods:
|
87
|
+
</b>
|
88
|
+
<!--NUMBER_OF_METHODS_INVESTIGATED-->
|
89
|
+
</p>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<ul class="nav nav-tabs mt-5">
|
95
|
+
<li class="nav-item">
|
96
|
+
<a class="nav-link active" type="button" data-bs-toggle="collapse"
|
97
|
+
data-bs-target="#overrides_inside_code_base" aria-expanded="true"
|
98
|
+
aria-controls="panelsStayOpen-collapseOne">
|
99
|
+
Overrides inside codebase
|
100
|
+
(<!--NUMBER_OF_OVERRIDES_INSIDE-->)
|
101
|
+
</a>
|
102
|
+
</li>
|
103
|
+
<li class="nav-item">
|
104
|
+
<a class="nav-link" type="button" data-bs-toggle="collapse" data-bs-target="#added_methods_inside_code_base"
|
105
|
+
aria-expanded="false" aria-controls="panelsStayOpen-collapseTwo">
|
106
|
+
Added methods inside codebase
|
107
|
+
(<!--NUMBER_OF_ADDED_METHODS-->)
|
108
|
+
</a>
|
109
|
+
</li>
|
110
|
+
<li class="nav-item">
|
111
|
+
<a class="nav-link" type="button" data-bs-toggle="collapse" data-bs-target="#overrides_outside_code_base"
|
112
|
+
aria-expanded="false" aria-controls="panelsStayOpen-collapseThree">
|
113
|
+
Overrides outside codebase
|
114
|
+
(<!--NUMBER_OF_OVERRIDES_OUTSIDE-->)
|
115
|
+
</a>
|
116
|
+
</li>
|
117
|
+
</ul>
|
118
|
+
<div class="accordion accordion-flush" id="accordionFlushExample">
|
119
|
+
<div class="accordion-item">
|
120
|
+
<div id="overrides_inside_code_base" class="accordion-collapse collapse show"
|
121
|
+
aria-labelledby="flush-headingOne" data-bs-parent="#accordionFlushExample">
|
122
|
+
<div class="accordion-body">
|
123
|
+
<div class="pt-5">
|
124
|
+
<!--OVERRIDES_INSIDE_CODEBASE-->
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
<div class="accordion-item">
|
130
|
+
<div id="added_methods_inside_code_base" class="accordion-collapse collapse"
|
131
|
+
aria-labelledby="flush-headingTwo" data-bs-parent="#accordionFlushExample">
|
132
|
+
<div class="accordion-body">
|
133
|
+
<div class="pt-5">
|
134
|
+
<!--ADDED_METHODS_INSIDE_CODEBASE-->
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
<div class="accordion-item">
|
140
|
+
<div id="overrides_outside_code_base" class="accordion-collapse collapse"
|
141
|
+
aria-labelledby="flush-headingThree" data-bs-parent="#accordionFlushExample">
|
142
|
+
<div class="accordion-body">
|
143
|
+
<div class="pt-5">
|
144
|
+
<!--OVERRIDES_OUTSIDE_CODEBASE-->
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
</div>
|
152
|
+
</div>
|
153
|
+
</body>
|
154
|
+
|
155
|
+
</html>
|
@@ -82,8 +82,7 @@ class OverridesTracker::Comparer
|
|
82
82
|
method_result_hash[:builds][build_id][:overriding_location] = all_methods_hash[unified_class_name][method_type][unified_method_name]['overriding_location']
|
83
83
|
method_result_hash[:builds][build_id][:overriding_sha] = all_methods_hash[unified_class_name][method_type][unified_method_name]['overriding_sha']
|
84
84
|
method_result_hash[:builds][build_id][:is_part_of_app] = all_methods_hash[unified_class_name][method_type][unified_method_name]['is_part_of_app'] || all_methods_hash[unified_class_name][method_type][unified_method_name]['overriding_is_part_of_app']
|
85
|
-
|
86
|
-
|
85
|
+
|
87
86
|
numbers[:overrides][:source_changed_count] += 1
|
88
87
|
is_source_changed_flag = true
|
89
88
|
is_override_changed_flag = false
|
@@ -97,8 +96,6 @@ class OverridesTracker::Comparer
|
|
97
96
|
method_result_hash[:builds][build_id][:overriding_sha] = all_methods_hash[unified_class_name][method_type][unified_method_name]['overriding_sha']
|
98
97
|
method_result_hash[:builds][build_id][:is_part_of_app] = all_methods_hash[unified_class_name][method_type][unified_method_name]['is_part_of_app'] || all_methods_hash[unified_class_name][method_type][unified_method_name]['overriding_is_part_of_app']
|
99
98
|
|
100
|
-
mask_path(method_result_hash[:builds][build_id], working_directories[build_id], bundle_directories[build_id])
|
101
|
-
|
102
99
|
numbers[:overrides][:override_changed_count] += 1
|
103
100
|
is_override_changed_flag = true
|
104
101
|
end
|
@@ -196,8 +193,6 @@ class OverridesTracker::Comparer
|
|
196
193
|
method_result_hash[:builds][build_id][:original_location] = all_methods_hash[unified_class_name][method_type][unified_method_name]['location']
|
197
194
|
method_result_hash[:builds][build_id][:is_part_of_app] = all_methods_hash[unified_class_name][method_type][unified_method_name]['is_part_of_app'] || all_methods_hash[unified_class_name][method_type][unified_method_name]['overriding_is_part_of_app']
|
198
195
|
|
199
|
-
mask_path(method_result_hash[:builds][build_id], working_directories[build_id], bundle_directories[build_id])
|
200
|
-
|
201
196
|
numbers[:added_methods][:source_changed_count] += 1
|
202
197
|
is_added_source_has_changed_flag = true
|
203
198
|
elsif all_methods_hash[unified_class_name][method_type][unified_method_name].nil?
|
@@ -240,18 +235,6 @@ class OverridesTracker::Comparer
|
|
240
235
|
{results: {override_results: results, added_method_results: added_method_results}, numbers: numbers}
|
241
236
|
end
|
242
237
|
|
243
|
-
def self.mask_path(build_hash, working_directory, bundle_directory)
|
244
|
-
if build_hash[:original_location]
|
245
|
-
build_hash[:original_location][0].gsub!(working_directory, 'APP_PATH')
|
246
|
-
build_hash[:original_location][0].gsub!(bundle_directory, 'BUNDLE_PATH')
|
247
|
-
end
|
248
|
-
|
249
|
-
if build_hash[:overriding_location]
|
250
|
-
build_hash[:overriding_location][0].gsub!(working_directory, 'APP_PATH')
|
251
|
-
build_hash[:overriding_location][0].gsub!(bundle_directory, 'BUNDLE_PATH')
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
238
|
def self.compare
|
256
239
|
all_methods_collections = {}
|
257
240
|
unified_methods_collections = {}
|
@@ -261,6 +244,8 @@ class OverridesTracker::Comparer
|
|
261
244
|
all_methods_collections = {}
|
262
245
|
unified_methods_collections = {}
|
263
246
|
report_files = Dir.entries(DO_BASE_DIR) - [".", ".."]
|
247
|
+
number_of_builds = 0
|
248
|
+
|
264
249
|
report_files.each do |file_name|
|
265
250
|
if file_name[-4..-1] == '.otf'
|
266
251
|
all_methods_collections[file_name] = {}
|
@@ -271,12 +256,13 @@ class OverridesTracker::Comparer
|
|
271
256
|
working_directories[file_name] = result_file_data['working_directory']
|
272
257
|
bundle_directories[file_name] = result_file_data['bundle_path']
|
273
258
|
unified_methods_collections = unified_methods_collections.deep_merge(methods_collection)
|
259
|
+
number_of_builds += 1
|
274
260
|
end
|
275
261
|
end
|
276
262
|
|
277
263
|
comparison = compare_builds(unified_methods_collections, all_methods_collections, working_directories, bundle_directories)
|
278
|
-
methods_count = 0
|
279
264
|
|
265
|
+
methods_count = 0
|
280
266
|
comparison[:results].each do |result_type, result_array|
|
281
267
|
result_array.each do |method_hash|
|
282
268
|
if method_hash[:builds] != {}
|
@@ -346,8 +332,140 @@ class OverridesTracker::Comparer
|
|
346
332
|
puts "Diffences on overrides: #{comparison[:numbers][:overrides][:total]/2}"
|
347
333
|
puts "Diffences on added methods: #{comparison[:numbers][:added_methods][:total]/2}"
|
348
334
|
|
335
|
+
write_html_report(comparison, number_of_builds, all_methods_collections)
|
336
|
+
|
349
337
|
comparison
|
350
338
|
end
|
351
339
|
|
340
|
+
def self.write_html_report(comparison, number_of_builds, all_methods_collections)
|
341
|
+
require 'fileutils'
|
342
|
+
source = File.join(Gem::Specification.find_by_name("overrides_tracker").gem_dir(), '/lib/html')
|
343
|
+
target = File.join(Dir.pwd, '/overrides_tracker')
|
344
|
+
FileUtils.copy_entry source, target
|
345
|
+
|
346
|
+
methods_count = 0
|
347
|
+
|
348
|
+
file_path = File.join(Dir.pwd, "/overrides_tracker/compare.html")
|
349
|
+
html_text = nil
|
350
|
+
begin
|
351
|
+
File.open(file_path) do |f|
|
352
|
+
html_text = f.read
|
353
|
+
end
|
354
|
+
rescue StandardError
|
355
|
+
puts "Error processing #{file_path}"
|
356
|
+
end
|
357
|
+
|
358
|
+
column_size = 12/number_of_builds
|
359
|
+
|
360
|
+
head = ''
|
361
|
+
all_methods_collections.each do |file_name, methods_collection|
|
362
|
+
head += '<div class="col-12 col-md-'+column_size.to_s+' pe-3">'
|
363
|
+
head += '<h6 class="text-dark">' + file_name + '</h6>'
|
364
|
+
head += '</div>'
|
365
|
+
end
|
366
|
+
|
367
|
+
html_text.gsub!('<!--FILENAMES-->', head)
|
368
|
+
|
369
|
+
overrides_in_app_path_methods_hash = comparison[:results][:override_results].select{ |mh| mh[:is_part_of_app] == true }
|
370
|
+
overrides_outside_app_path_methods_hash = comparison[:results][:override_results].select{ |mh| mh[:is_part_of_app] == false }
|
371
|
+
added_methods_hash = comparison[:results][:added_method_results].select{ |mh| mh[:builds].any?}
|
372
|
+
|
373
|
+
html_text.gsub!('<!--OVERRIDES_INSIDE_CODEBASE-->', write_comparison_html(overrides_in_app_path_methods_hash, column_size))
|
374
|
+
html_text.gsub!('<!--ADDED_METHODS_INSIDE_CODEBASE-->', write_comparison_html(added_methods_hash, column_size))
|
375
|
+
html_text.gsub!('<!--OVERRIDES_OUTSIDE_CODEBASE-->', write_comparison_html(overrides_outside_app_path_methods_hash, column_size))
|
376
|
+
|
377
|
+
html_text.gsub!('<!--NUMBER_OF_OVERRIDES_INSIDE-->', overrides_in_app_path_methods_hash.count.to_s)
|
378
|
+
html_text.gsub!('<!--NUMBER_OF_ADDED_METHODS-->', added_methods_hash.count.to_s)
|
379
|
+
html_text.gsub!('<!--NUMBER_OF_OVERRIDES_OUTSIDE-->', overrides_outside_app_path_methods_hash.count.to_s)
|
380
|
+
|
381
|
+
File.open(file_path, 'w') do |f|
|
382
|
+
f << html_text
|
383
|
+
end
|
384
|
+
|
385
|
+
puts '==========='
|
386
|
+
puts "Find your comparison here:"
|
387
|
+
puts "#{file_path}"
|
388
|
+
end
|
389
|
+
|
390
|
+
def self.write_comparison_html(methods_hash, column_size)
|
391
|
+
puts methods_hash.first.to_s
|
392
|
+
output=''
|
393
|
+
if methods_hash.any?
|
394
|
+
methods_hash.each do |method_hash|
|
395
|
+
if method_hash[:builds] != nil
|
396
|
+
output+='<h4 class="break-all-words">'
|
397
|
+
if method_hash[:method_type].include?('instance')
|
398
|
+
output+= "#{method_hash[:class_name]}##{method_hash[:method_name]}"
|
399
|
+
else
|
400
|
+
output+= "#{method_hash[:class_name]}.#{method_hash[:method_name]}"
|
401
|
+
end
|
402
|
+
output+='</h4>'
|
403
|
+
|
404
|
+
output+='<div class="row">'
|
405
|
+
method_hash[:builds].each do |build_id, build_result|
|
406
|
+
output+='<div class="col-12 col-md-'+column_size.to_s+'">'
|
407
|
+
if build_result[:result] != 'source_has_changed'
|
408
|
+
output+= "#{build_result[:result]}"
|
409
|
+
end
|
410
|
+
output+='</div>'
|
411
|
+
end
|
412
|
+
output+='</div>'
|
413
|
+
|
414
|
+
output+='<div class="row">'
|
415
|
+
method_hash[:builds].each do |build_id, build_result|
|
416
|
+
output+='<div class="col-12 col-md-'+column_size.to_s+'">'
|
417
|
+
unless build_result[:original_body].nil?
|
418
|
+
output+='<h6>'
|
419
|
+
output+= 'Original source'
|
420
|
+
output+='</h6>'
|
421
|
+
output+= html_code_block(build_result[:original_body], build_result[:original_location][1], build_result[:original_location][0], method_hash[:mark_lines])
|
422
|
+
end
|
423
|
+
output+='</div>'
|
424
|
+
end
|
425
|
+
output+='</div>'
|
426
|
+
|
427
|
+
output+='<div class="row">'
|
428
|
+
method_hash[:builds].each do |build_id, build_result|
|
429
|
+
output+='<div class="col-12 col-md-'+column_size.to_s+'">'
|
430
|
+
unless build_result[:overriding_body].nil?
|
431
|
+
output+='<h6>'
|
432
|
+
output+= 'Override'
|
433
|
+
output+='</h6>'
|
434
|
+
output+= html_code_block(build_result[:overriding_body], build_result[:overriding_location][1], build_result[:overriding_location][0], method_hash[:overriding_mark_lines])
|
435
|
+
end
|
436
|
+
output+='</div>'
|
437
|
+
end
|
438
|
+
output+='</div>'
|
439
|
+
output+='<hr>'
|
440
|
+
end
|
441
|
+
end
|
442
|
+
else
|
443
|
+
output+='<p>'
|
444
|
+
output+= 'No differences'
|
445
|
+
output+='</p>'
|
446
|
+
end
|
447
|
+
output
|
448
|
+
end
|
449
|
+
|
450
|
+
def self.html_code_block(code, starting_line, location, mark_lines = nil)
|
451
|
+
output = ''
|
452
|
+
output += "<p class='text-break text-muted'>#{location}:#{starting_line}"
|
453
|
+
output += '<button class="btn btn-primary btn-sm clipboard-btn ms-2" type="button" data-clipboard-action="copy" data-clipboard-text="' + location + ':' + starting_line.to_s + '">'
|
454
|
+
output += '<i class="mdi mdi-content-copy"></i>'
|
455
|
+
output += '</button>'
|
456
|
+
output += '</p>'
|
457
|
+
output += '<div id="block">'
|
458
|
+
output += '<pre>'
|
459
|
+
if mark_lines == nil
|
460
|
+
output += '<code class="codeblock javascript" style="counter-reset: line-numbering ' + (starting_line-1).to_s + ';" data-mark-lines="">'
|
461
|
+
else
|
462
|
+
output += '<code class="marked_block javascript" style="counter-reset: line-numbering ' + (starting_line-1).to_s + ';" data-mark-lines="' + mark_lines.to_s + '">'
|
463
|
+
end
|
464
|
+
output += code
|
465
|
+
output += '</code>'
|
466
|
+
output += '</pre>'
|
467
|
+
output += '</div>'
|
468
|
+
output
|
469
|
+
end
|
352
470
|
end
|
353
471
|
|
@@ -204,7 +204,7 @@ overriding_method.source_location
|
|
204
204
|
file_data[:last_commit_name_to_report] = last_commit_name_to_report
|
205
205
|
file_data[:working_directory] = Dir.pwd
|
206
206
|
file_data[:bundle_path] = Bundler.bundle_path.to_s
|
207
|
-
file_data[:methods_collection] = @overridden_methods_collection
|
207
|
+
file_data[:methods_collection] = @overridden_methods_collection.sort.to_h
|
208
208
|
|
209
209
|
classes_with_overrides = @methods_collection.select do |_key, val|
|
210
210
|
!val[:instance_methods].nil? || !val[:singleton_methods].nil?
|
@@ -233,6 +233,154 @@ overriding_method.source_location
|
|
233
233
|
puts "Report saved to #{path_to_report_file}."
|
234
234
|
end
|
235
235
|
|
236
|
+
def write_html_report
|
237
|
+
require 'fileutils'
|
238
|
+
source = File.join(Gem::Specification.find_by_name("overrides_tracker").gem_dir(), '/lib/html')
|
239
|
+
target = File.join(Dir.pwd, '/overrides_tracker')
|
240
|
+
FileUtils.copy_entry source, target
|
241
|
+
|
242
|
+
file_path = File.join(Dir.pwd, "/overrides_tracker/summary.html")
|
243
|
+
html_text = nil
|
244
|
+
begin
|
245
|
+
File.open(file_path) do |f|
|
246
|
+
html_text = f.read
|
247
|
+
end
|
248
|
+
rescue StandardError
|
249
|
+
puts "Error processing #{file_path}"
|
250
|
+
end
|
251
|
+
|
252
|
+
overrides_inside_codebase = ''
|
253
|
+
added_methods_inside_codebase = ''
|
254
|
+
overrides_outside_codebase = ''
|
255
|
+
|
256
|
+
number_of_overrides_inside = 0
|
257
|
+
number_of_overrides_outside = 0
|
258
|
+
number_of_added_methods = 0
|
259
|
+
|
260
|
+
@overridden_methods_collection.sort.to_h.each do |class_name, class_methods|
|
261
|
+
class_methods[:instance_methods].each do |method_name, method_hash|
|
262
|
+
if method_hash[:is_part_of_app] || method_hash[:overriding_is_part_of_app]
|
263
|
+
overrides_inside_codebase += write_override_html(class_name, method_name, method_hash, '#', 'overridden')
|
264
|
+
number_of_overrides_inside+=1
|
265
|
+
else
|
266
|
+
overrides_outside_codebase += write_override_html(class_name, method_name, method_hash, '#', 'overridden')
|
267
|
+
number_of_overrides_outside+=1
|
268
|
+
end
|
269
|
+
end
|
270
|
+
class_methods[:singleton_methods].each do |method_name, method_hash|
|
271
|
+
if method_hash[:is_part_of_app] || method_hash[:overriding_is_part_of_app]
|
272
|
+
overrides_inside_codebase += write_override_html(class_name, method_name, method_hash, '.', 'overridden')
|
273
|
+
number_of_overrides_inside+=1
|
274
|
+
else
|
275
|
+
overrides_outside_codebase += write_override_html(class_name, method_name, method_hash, '.', 'overridden')
|
276
|
+
number_of_overrides_outside+=1
|
277
|
+
end
|
278
|
+
end
|
279
|
+
class_methods[:added_instance_methods].each do |method_name, method_hash|
|
280
|
+
added_methods_inside_codebase += write_override_html(class_name, method_name, method_hash, '#', 'added')
|
281
|
+
number_of_added_methods+=1
|
282
|
+
end
|
283
|
+
class_methods[:added_singleton_methods].each do |method_name, method_hash|
|
284
|
+
added_methods_inside_codebase += write_override_html(class_name, method_name, method_hash, '.', 'added')
|
285
|
+
number_of_added_methods+=1
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
html_text.gsub!('<!--DATE-->', DateTime.now.strftime('%d/%m/%Y %H:%M:%S'))
|
290
|
+
html_text.gsub!('<!--BRANCH_NAME-->', branch_name)
|
291
|
+
html_text.gsub!('<!--BRANCH_NAME_TO_REPORT-->', branch_name_to_report)
|
292
|
+
html_text.gsub!('<!--LAST_COMMIT_ID-->', last_commit_id)
|
293
|
+
html_text.gsub!('<!--LAST_COMMIT_NAME-->', last_commit_name)
|
294
|
+
|
295
|
+
classes_with_overrides = @methods_collection.select do |_key, val|
|
296
|
+
!val[:instance_methods].nil? || !val[:singleton_methods].nil?
|
297
|
+
end
|
298
|
+
classes_with_overrides_transformed = classes_with_overrides.map do |k, v|
|
299
|
+
[k, v[:instance_methods], v[:singleton_methods]]
|
300
|
+
end
|
301
|
+
|
302
|
+
html_text.gsub!('<!--NUMBER_OF_CLASSES_INVESTIGATED-->', @methods_collection.size.to_s)
|
303
|
+
html_text.gsub!('<!--NUMBER_OF_METHODS_INVESTIGATED-->', classes_with_overrides_transformed.sum { |a| a[1].size + a[2].size }.to_s)
|
304
|
+
|
305
|
+
html_text.gsub!('<!--NUMBER_OF_OVERRIDES_INSIDE-->', number_of_overrides_inside.to_s)
|
306
|
+
html_text.gsub!('<!--NUMBER_OF_ADDED_METHODS-->', number_of_added_methods.to_s)
|
307
|
+
html_text.gsub!('<!--NUMBER_OF_OVERRIDES_OUTSIDE-->', number_of_overrides_outside.to_s)
|
308
|
+
|
309
|
+
html_text.gsub!('<!--OVERRIDES_INSIDE_CODEBASE-->', overrides_inside_codebase)
|
310
|
+
html_text.gsub!('<!--ADDED_METHODS_INSIDE_CODEBASE-->', added_methods_inside_codebase)
|
311
|
+
html_text.gsub!('<!--OVERRIDES_OUTSIDE_CODEBASE-->', overrides_outside_codebase)
|
312
|
+
|
313
|
+
File.open(file_path, 'w') do |f|
|
314
|
+
f << html_text
|
315
|
+
end
|
316
|
+
|
317
|
+
puts ' '
|
318
|
+
puts '==========='
|
319
|
+
puts "Find your all your overrides here:"
|
320
|
+
puts "#{file_path}"
|
321
|
+
end
|
322
|
+
|
323
|
+
def write_override_html(class_name, method_name, method_hash, separator = '#', word_choice = 'overridden')
|
324
|
+
output ='<div class="col-12">'
|
325
|
+
output +='<h4 class="break-all-words">'
|
326
|
+
output +="#{class_name}#{separator}#{method_name}"
|
327
|
+
output +='</h4>'
|
328
|
+
output +='</div>'
|
329
|
+
output +='<div class="row">'
|
330
|
+
output +='<div class="col-12 col-md-6">'
|
331
|
+
output +='<h6 class="break-all-words">'
|
332
|
+
output +='Original source'
|
333
|
+
output +='</h6>'
|
334
|
+
unless method_hash[:body].nil?
|
335
|
+
output +='<p class="text-break text-muted">'
|
336
|
+
output +="#{method_hash[:location][0]}:#{method_hash[:location][1]}"
|
337
|
+
output +='<button class="btn btn-primary btn-sm clipboard-btn ms-2" data-clipboard-action="copy" data-clipboard-text="'+"#{method_hash[:location][0]}:#{method_hash[:location][1]}"+'" type="button">'
|
338
|
+
output +='<i class="mdi mdi-content-copy"></i>'
|
339
|
+
output +='</button>'
|
340
|
+
output +='</p>'
|
341
|
+
output +='<div id="block">'
|
342
|
+
output +='<pre><code class="codeblock javascript" data-mark-lines="" style="counter-reset: line-numbering 6;">'
|
343
|
+
output += method_hash[:body]
|
344
|
+
output +='</code>'
|
345
|
+
output +='</pre>'
|
346
|
+
else
|
347
|
+
output +='<p class="text-break text-muted">'
|
348
|
+
output +="Not found"
|
349
|
+
output +='</p'
|
350
|
+
end
|
351
|
+
output +='</div>'
|
352
|
+
output +='</div>'
|
353
|
+
output +='<div class="col-12 col-md-6">'
|
354
|
+
output +='<h6>'
|
355
|
+
output +='Override'
|
356
|
+
output +='</h6>'
|
357
|
+
unless method_hash[:overriding_body].nil?
|
358
|
+
output +='<p class="text-break text-muted">'
|
359
|
+
output +="#{method_hash[:overriding_location][0]}:#{method_hash[:overriding_location][1]}"
|
360
|
+
output +='<button class="btn btn-primary btn-sm clipboard-btn ms-2" data-clipboard-action="copy" data-clipboard-text="'+"#{method_hash[:overriding_location][0]}:#{method_hash[:overriding_location][1]}"+'" type="button">'
|
361
|
+
output +='<i class="mdi mdi-content-copy"></i>'
|
362
|
+
output +='</button>'
|
363
|
+
output +='</p>'
|
364
|
+
output +='<div id="block">'
|
365
|
+
output +='<pre><code class="codeblock javascript" data-mark-lines="" style="counter-reset: line-numbering 28;">'
|
366
|
+
output += method_hash[:overriding_body]
|
367
|
+
output +='</code>'
|
368
|
+
output +='</pre>'
|
369
|
+
|
370
|
+
else
|
371
|
+
output +='<p class="text-break text-muted">'
|
372
|
+
output +="Not found"
|
373
|
+
output +='</p'
|
374
|
+
end
|
375
|
+
output +='</div>'
|
376
|
+
output +='</div>'
|
377
|
+
output +='</div>'
|
378
|
+
output +='<hr/>'
|
379
|
+
|
380
|
+
return output
|
381
|
+
end
|
382
|
+
|
383
|
+
|
236
384
|
def report(api_token)
|
237
385
|
OverridesTracker::Api.report_build(api_token, branch_name_to_report, last_commit_id, last_commit_name_to_report, path_to_report_file)
|
238
386
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|