288 |
296 |
297 |
298 | """)
299 |
300 | # Iterates through each used check's details and organizes them into the given sections.
301 | f.write("""
302 |
303 | {} Original Log
304 |
305 | """.format(total_num_checks))
306 |
307 | for line in range(0, num_used_checks):
308 | f.write("""
309 |
310 | {1} {2}
311 |
312 | """.format(line, names_of_used[line].count, names_of_used[line].name.replace('/', '-')))
313 |
314 | f.write("""
315 |
316 |
317 |
318 |
319 |
320 |
321 |
Original Log
322 | """)
323 |
324 | # Attach a button to the list of all checks in clang. Link opens in a new tab.
325 | clang_check_url = clang_base_url.replace('/', '\/') + 'list.html'
326 | external_name = 'Clang-Tidy Checks'
327 | f.write("""
328 |
330 | {}
331 |
332 |
333 | """.format(clang_check_url, external_name))
334 |
335 | f.write("""
336 |
337 |
338 | """)
339 |
340 | # Sort through the used check logs for outputting the html.
341 | def writeSortedLogs(f, tidy_log_lines, num_used_checks, names_of_used, clang_base_url):
342 | for line in tidy_log_lines:
343 | line = line.replace('<', '<')
344 | line = line.replace('>', '>')
345 | f.write("{}\n".format(line))
346 |
347 | f.write("""
348 |
349 |
350 | """)
351 |
352 | for check_idx in range(0, num_used_checks):
353 | collapse_idx = check_idx + 1
354 | f.write("""
355 |
356 |
357 |
359 |
360 |
361 | {2}
362 |
363 | """.format(check_idx, collapse_idx, names_of_used[check_idx].name))
364 |
365 | # Attach a button to the specific check's docs in clang. Link opens in a new tab.
366 | docs_check_name = toClangDocsName(names_of_used[check_idx].name)
367 | clang_check_url = clang_base_url.replace(
368 | '/', '\/') + docs_check_name + '.html'
369 | external_name = 'Documentation'
370 | f.write("""
371 |
373 | {}
374 |
375 |
376 | """.format(clang_check_url, external_name))
377 |
378 | f.write("""
379 |
380 |
381 | """)
382 |
383 | names_of_used[check_idx].data = names_of_used[check_idx].data.replace(
384 | '<', '<')
385 | names_of_used[check_idx].data = names_of_used[check_idx].data.replace(
386 | '>', '>')
387 | names_of_used[check_idx].data = ansi_to_html(
388 | names_of_used[check_idx].data)
389 | f.write("""{}
390 |
391 |
392 | """.format(names_of_used[check_idx].data))
393 |
394 | f.write("""
395 |
396 |
397 | """)
398 |
399 | # Writes Javascript and JQuery code to the html file for button and grouping functionalities.
400 | def writeScript(f, num_used_checks):
401 | f.write("""
402 |
546 |
556 |
557 |
558 | """.format(num_used_checks))
559 |
--------------------------------------------------------------------------------
/examples/clang.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
17 |
25 |
26 |
61 |
62 |
63 |
64 |
65 |
66 |
Original Log
67 |
68 |
70 | Clang-Tidy Checks
71 |
72 |
73 |
74 |
75 |
76 | /home/ahale/clangtidy_generator/clang_visualizer.c:6:1: warning: #includes are not sorted properly [llvm-include-order]
77 | #include <stdio.h>
78 | ^ ~~~~~~~~~
79 | <stddef.h>
80 | /home/ahale/clangtidy_generator/clang_visualizer.c:27:6: warning: function 'read_log' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
81 | void read_log(FILE *log, node_t *head, node_t **next, char line[]);
82 | ^ ~~~~~
83 | log_line
84 | /home/ahale/clangtidy_generator/clang_visualizer.c:1105:6: note: the definition seen here
85 | void read_log(FILE *log, node_t *head, node_t **next, char log_line[])
86 | ^
87 | /home/ahale/clangtidy_generator/clang_visualizer.c:27:6: note: differing parameters are named here: ('line'), in definition: ('log_line')
88 | void read_log(FILE *log, node_t *head, node_t **next, char line[]);
89 | ^
90 | /home/ahale/clangtidy_generator/clang_visualizer.c:1061:32: warning: use 'fopen' mode 'e' to set O_CLOEXEC [android-cloexec-fopen]
91 | html = fopen("clangtidy.html","w");
92 | ^~~~
93 | "we"
94 | /home/ahale/clangtidy_generator/clang_visualizer.c:1062:23: warning: use 'fopen' mode 'e' to set O_CLOEXEC [android-cloexec-fopen]
95 | log = fopen(argv[1], "r");
96 | ^~~~
97 | "re"
98 | /home/ahale/clangtidy_generator/clang_visualizer.c:1094:45: warning: statement should be inside braces [hicpp-braces-around-statements]
99 | for (int idx=0; idx < used_checks_amt; idx++)
100 | ^
101 | {
102 | /home/ahale/clangtidy_generator/clang_visualizer.c:1114:42: warning: statement should be inside braces [hicpp-braces-around-statements]
103 | if (strstr(log_line,checks_list[idx]))
104 | ^
105 | {
106 | /home/ahale/clangtidy_generator/clang_visualizer.c:1133:4: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
107 | strcpy(used_checks_list[new_checks_idx].name, checks_list[used_idx]);
108 | ^
109 | /home/ahale/clangtidy_generator/clang_visualizer.c:1133:4: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
110 | /home/ahale/clangtidy_generator/clang_visualizer.c:1145:31: warning: statement should be inside braces [readability-braces-around-statements]
111 | if (used_checks_list == NULL)
112 | ^
113 | {
114 | /home/ahale/clangtidy_generator/clang_visualizer.c:1155:25: warning: statement should be inside braces [readability-braces-around-statements]
115 | if (check_details > 3)
116 | ^
117 | {
118 | /home/ahale/clangtidy_generator/clang_visualizer.c:1231:53: warning: statement should be inside braces [google-readability-braces-around-statements]
119 | for (struct node *ptr = head; ptr; ptr = ptr->next)
120 | ^
121 | {
122 |
123 |
124 |
125 |
126 |
127 |
128 |
130 |
131 |
132 | android-cloexec-fopen
133 |
134 |
135 |
137 | Documentation
138 |
139 |
140 |
141 |
142 |
143 | /home/ahale/clangtidy_generator/clang_visualizer.c:1061:32: warning: use 'fopen' mode 'e' to set O_CLOEXEC [android-cloexec-fopen]
144 | html = fopen("clangtidy.html","w");
145 | ^~~~
146 | "we"
147 | /home/ahale/clangtidy_generator/clang_visualizer.c:1062:23: warning: use 'fopen' mode 'e' to set O_CLOEXEC [android-cloexec-fopen]
148 | log = fopen(argv[1], "r");
149 | ^~~~
150 | "re"
151 |
152 |
153 |
154 |
155 |
156 |
157 |
159 |
160 |
161 | clang-analyzer-security.insecureAPI.strcpy
162 |
163 |
164 |
166 | Documentation
167 |
168 |
169 |
170 |
171 |
172 | /home/ahale/clangtidy_generator/clang_visualizer.c:1133:4: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
173 | strcpy(used_checks_list[new_checks_idx].name, checks_list[used_idx]);
174 | ^
175 | /home/ahale/clangtidy_generator/clang_visualizer.c:1133:4: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
176 |
177 |
178 |
179 |
180 |
181 |
182 |
184 |
185 |
186 | google-readability-braces-around-statements
187 |
188 |
189 |
191 | Documentation
192 |
193 |
194 |
195 |
196 |
197 | /home/ahale/clangtidy_generator/clang_visualizer.c:1231:53: warning: statement should be inside braces [google-readability-braces-around-statements]
198 | for (struct node *ptr = head; ptr; ptr = ptr->next)
199 | ^
200 | {
201 |
202 |
203 |
204 |
205 |
206 |
207 |
209 |
210 |
211 | hicpp-braces-around-statements
212 |
213 |
214 |
216 | Documentation
217 |
218 |
219 |
220 |
221 |
222 | /home/ahale/clangtidy_generator/clang_visualizer.c:1094:45: warning: statement should be inside braces [hicpp-braces-around-statements]
223 | for (int idx=0; idx < used_checks_amt; idx++)
224 | ^
225 | {
226 | /home/ahale/clangtidy_generator/clang_visualizer.c:1114:42: warning: statement should be inside braces [hicpp-braces-around-statements]
227 | if (strstr(log_line,checks_list[idx]))
228 | ^
229 | {
230 |
231 |
232 |
233 |
234 |
235 |
236 |
238 |
239 |
240 | llvm-include-order
241 |
242 |
243 |
245 | Documentation
246 |
247 |
248 |
249 |
250 |
251 | /home/ahale/clangtidy_generator/clang_visualizer.c:6:1: warning: #includes are not sorted properly [llvm-include-order]
252 | #include <stdio.h>
253 | ^ ~~~~~~~~~
254 | <stddef.h>
255 |
256 |
257 |
258 |
259 |
260 |
261 |
263 |
264 |
265 | readability-braces-around-statements
266 |
267 |
268 |
270 | Documentation
271 |
272 |
273 |
274 |
275 |
276 | /home/ahale/clangtidy_generator/clang_visualizer.c:1145:31: warning: statement should be inside braces [readability-braces-around-statements]
277 | if (used_checks_list == NULL)
278 | ^
279 | {
280 | /home/ahale/clangtidy_generator/clang_visualizer.c:1155:25: warning: statement should be inside braces [readability-braces-around-statements]
281 | if (check_details > 3)
282 | ^
283 | {
284 | /home/ahale/clangtidy_generator/clang_visualizer.c:1231:53: warning: statement should be inside braces [google-readability-braces-around-statements]
285 | for (struct node *ptr = head; ptr; ptr = ptr->next)
286 | ^
287 | {
288 |
289 |
290 |
291 |
292 |
293 |
294 |
296 |
297 |
298 | readability-inconsistent-declaration-parameter-name
299 |
300 |
301 |
303 | Documentation
304 |
305 |
306 |
307 |
308 |
309 | /home/ahale/clangtidy_generator/clang_visualizer.c:27:6: warning: function 'read_log' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
310 | void read_log(FILE *log, node_t *head, node_t **next, char line[]);
311 | ^ ~~~~~
312 | log_line
313 | /home/ahale/clangtidy_generator/clang_visualizer.c:1105:6: note: the definition seen here
314 | void read_log(FILE *log, node_t *head, node_t **next, char log_line[])
315 | ^
316 | /home/ahale/clangtidy_generator/clang_visualizer.c:27:6: note: differing parameters are named here: ('line'), in definition: ('log_line')
317 | void read_log(FILE *log, node_t *head, node_t **next, char line[]);
318 | ^
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
470 |
480 |
481 |
482 |
--------------------------------------------------------------------------------