brakeman-lib 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +872 -0
  3. data/FEATURES +16 -0
  4. data/README.md +169 -0
  5. data/WARNING_TYPES +95 -0
  6. data/bin/brakeman +89 -0
  7. data/lib/brakeman.rb +495 -0
  8. data/lib/brakeman/app_tree.rb +161 -0
  9. data/lib/brakeman/brakeman.rake +17 -0
  10. data/lib/brakeman/call_index.rb +219 -0
  11. data/lib/brakeman/checks.rb +191 -0
  12. data/lib/brakeman/checks/base_check.rb +518 -0
  13. data/lib/brakeman/checks/check_basic_auth.rb +88 -0
  14. data/lib/brakeman/checks/check_basic_auth_timing_attack.rb +33 -0
  15. data/lib/brakeman/checks/check_content_tag.rb +160 -0
  16. data/lib/brakeman/checks/check_create_with.rb +75 -0
  17. data/lib/brakeman/checks/check_cross_site_scripting.rb +385 -0
  18. data/lib/brakeman/checks/check_default_routes.rb +86 -0
  19. data/lib/brakeman/checks/check_deserialize.rb +57 -0
  20. data/lib/brakeman/checks/check_detailed_exceptions.rb +55 -0
  21. data/lib/brakeman/checks/check_digest_dos.rb +38 -0
  22. data/lib/brakeman/checks/check_dynamic_finders.rb +49 -0
  23. data/lib/brakeman/checks/check_escape_function.rb +21 -0
  24. data/lib/brakeman/checks/check_evaluation.rb +36 -0
  25. data/lib/brakeman/checks/check_execute.rb +167 -0
  26. data/lib/brakeman/checks/check_file_access.rb +63 -0
  27. data/lib/brakeman/checks/check_file_disclosure.rb +35 -0
  28. data/lib/brakeman/checks/check_filter_skipping.rb +31 -0
  29. data/lib/brakeman/checks/check_forgery_setting.rb +74 -0
  30. data/lib/brakeman/checks/check_header_dos.rb +31 -0
  31. data/lib/brakeman/checks/check_i18n_xss.rb +48 -0
  32. data/lib/brakeman/checks/check_jruby_xml.rb +38 -0
  33. data/lib/brakeman/checks/check_json_encoding.rb +47 -0
  34. data/lib/brakeman/checks/check_json_parsing.rb +107 -0
  35. data/lib/brakeman/checks/check_link_to.rb +132 -0
  36. data/lib/brakeman/checks/check_link_to_href.rb +115 -0
  37. data/lib/brakeman/checks/check_mail_to.rb +49 -0
  38. data/lib/brakeman/checks/check_mass_assignment.rb +198 -0
  39. data/lib/brakeman/checks/check_mime_type_dos.rb +39 -0
  40. data/lib/brakeman/checks/check_model_attr_accessible.rb +55 -0
  41. data/lib/brakeman/checks/check_model_attributes.rb +119 -0
  42. data/lib/brakeman/checks/check_model_serialize.rb +67 -0
  43. data/lib/brakeman/checks/check_nested_attributes.rb +38 -0
  44. data/lib/brakeman/checks/check_nested_attributes_bypass.rb +58 -0
  45. data/lib/brakeman/checks/check_number_to_currency.rb +74 -0
  46. data/lib/brakeman/checks/check_quote_table_name.rb +40 -0
  47. data/lib/brakeman/checks/check_redirect.rb +215 -0
  48. data/lib/brakeman/checks/check_regex_dos.rb +69 -0
  49. data/lib/brakeman/checks/check_render.rb +92 -0
  50. data/lib/brakeman/checks/check_render_dos.rb +37 -0
  51. data/lib/brakeman/checks/check_render_inline.rb +54 -0
  52. data/lib/brakeman/checks/check_response_splitting.rb +21 -0
  53. data/lib/brakeman/checks/check_route_dos.rb +42 -0
  54. data/lib/brakeman/checks/check_safe_buffer_manipulation.rb +31 -0
  55. data/lib/brakeman/checks/check_sanitize_methods.rb +79 -0
  56. data/lib/brakeman/checks/check_secrets.rb +40 -0
  57. data/lib/brakeman/checks/check_select_tag.rb +60 -0
  58. data/lib/brakeman/checks/check_select_vulnerability.rb +60 -0
  59. data/lib/brakeman/checks/check_send.rb +48 -0
  60. data/lib/brakeman/checks/check_send_file.rb +19 -0
  61. data/lib/brakeman/checks/check_session_manipulation.rb +36 -0
  62. data/lib/brakeman/checks/check_session_settings.rb +170 -0
  63. data/lib/brakeman/checks/check_simple_format.rb +59 -0
  64. data/lib/brakeman/checks/check_single_quotes.rb +101 -0
  65. data/lib/brakeman/checks/check_skip_before_filter.rb +60 -0
  66. data/lib/brakeman/checks/check_sql.rb +660 -0
  67. data/lib/brakeman/checks/check_sql_cves.rb +101 -0
  68. data/lib/brakeman/checks/check_ssl_verify.rb +49 -0
  69. data/lib/brakeman/checks/check_strip_tags.rb +89 -0
  70. data/lib/brakeman/checks/check_symbol_dos.rb +64 -0
  71. data/lib/brakeman/checks/check_symbol_dos_cve.rb +30 -0
  72. data/lib/brakeman/checks/check_translate_bug.rb +45 -0
  73. data/lib/brakeman/checks/check_unsafe_reflection.rb +51 -0
  74. data/lib/brakeman/checks/check_unscoped_find.rb +41 -0
  75. data/lib/brakeman/checks/check_validation_regex.rb +116 -0
  76. data/lib/brakeman/checks/check_weak_hash.rb +151 -0
  77. data/lib/brakeman/checks/check_without_protection.rb +80 -0
  78. data/lib/brakeman/checks/check_xml_dos.rb +51 -0
  79. data/lib/brakeman/checks/check_yaml_parsing.rb +121 -0
  80. data/lib/brakeman/differ.rb +66 -0
  81. data/lib/brakeman/file_parser.rb +50 -0
  82. data/lib/brakeman/format/style.css +133 -0
  83. data/lib/brakeman/options.rb +301 -0
  84. data/lib/brakeman/parsers/rails2_erubis.rb +6 -0
  85. data/lib/brakeman/parsers/rails2_xss_plugin_erubis.rb +48 -0
  86. data/lib/brakeman/parsers/rails3_erubis.rb +74 -0
  87. data/lib/brakeman/parsers/template_parser.rb +89 -0
  88. data/lib/brakeman/processor.rb +102 -0
  89. data/lib/brakeman/processors/alias_processor.rb +1013 -0
  90. data/lib/brakeman/processors/base_processor.rb +277 -0
  91. data/lib/brakeman/processors/config_processor.rb +14 -0
  92. data/lib/brakeman/processors/controller_alias_processor.rb +273 -0
  93. data/lib/brakeman/processors/controller_processor.rb +326 -0
  94. data/lib/brakeman/processors/erb_template_processor.rb +80 -0
  95. data/lib/brakeman/processors/erubis_template_processor.rb +104 -0
  96. data/lib/brakeman/processors/gem_processor.rb +57 -0
  97. data/lib/brakeman/processors/haml_template_processor.rb +190 -0
  98. data/lib/brakeman/processors/lib/basic_processor.rb +37 -0
  99. data/lib/brakeman/processors/lib/find_all_calls.rb +223 -0
  100. data/lib/brakeman/processors/lib/find_call.rb +183 -0
  101. data/lib/brakeman/processors/lib/find_return_value.rb +134 -0
  102. data/lib/brakeman/processors/lib/processor_helper.rb +75 -0
  103. data/lib/brakeman/processors/lib/rails2_config_processor.rb +145 -0
  104. data/lib/brakeman/processors/lib/rails2_route_processor.rb +313 -0
  105. data/lib/brakeman/processors/lib/rails3_config_processor.rb +132 -0
  106. data/lib/brakeman/processors/lib/rails3_route_processor.rb +308 -0
  107. data/lib/brakeman/processors/lib/render_helper.rb +181 -0
  108. data/lib/brakeman/processors/lib/render_path.rb +107 -0
  109. data/lib/brakeman/processors/lib/route_helper.rb +68 -0
  110. data/lib/brakeman/processors/lib/safe_call_helper.rb +16 -0
  111. data/lib/brakeman/processors/library_processor.rb +119 -0
  112. data/lib/brakeman/processors/model_processor.rb +191 -0
  113. data/lib/brakeman/processors/output_processor.rb +171 -0
  114. data/lib/brakeman/processors/route_processor.rb +17 -0
  115. data/lib/brakeman/processors/slim_template_processor.rb +107 -0
  116. data/lib/brakeman/processors/template_alias_processor.rb +116 -0
  117. data/lib/brakeman/processors/template_processor.rb +74 -0
  118. data/lib/brakeman/report.rb +78 -0
  119. data/lib/brakeman/report/config/remediation.yml +71 -0
  120. data/lib/brakeman/report/ignore/config.rb +135 -0
  121. data/lib/brakeman/report/ignore/interactive.rb +311 -0
  122. data/lib/brakeman/report/renderer.rb +24 -0
  123. data/lib/brakeman/report/report_base.rb +286 -0
  124. data/lib/brakeman/report/report_codeclimate.rb +70 -0
  125. data/lib/brakeman/report/report_csv.rb +55 -0
  126. data/lib/brakeman/report/report_hash.rb +23 -0
  127. data/lib/brakeman/report/report_html.rb +216 -0
  128. data/lib/brakeman/report/report_json.rb +42 -0
  129. data/lib/brakeman/report/report_markdown.rb +156 -0
  130. data/lib/brakeman/report/report_table.rb +107 -0
  131. data/lib/brakeman/report/report_tabs.rb +17 -0
  132. data/lib/brakeman/report/templates/controller_overview.html.erb +22 -0
  133. data/lib/brakeman/report/templates/controller_warnings.html.erb +21 -0
  134. data/lib/brakeman/report/templates/error_overview.html.erb +29 -0
  135. data/lib/brakeman/report/templates/header.html.erb +58 -0
  136. data/lib/brakeman/report/templates/ignored_warnings.html.erb +25 -0
  137. data/lib/brakeman/report/templates/model_warnings.html.erb +21 -0
  138. data/lib/brakeman/report/templates/overview.html.erb +38 -0
  139. data/lib/brakeman/report/templates/security_warnings.html.erb +23 -0
  140. data/lib/brakeman/report/templates/template_overview.html.erb +21 -0
  141. data/lib/brakeman/report/templates/view_warnings.html.erb +34 -0
  142. data/lib/brakeman/report/templates/warning_overview.html.erb +17 -0
  143. data/lib/brakeman/rescanner.rb +483 -0
  144. data/lib/brakeman/scanner.rb +317 -0
  145. data/lib/brakeman/tracker.rb +347 -0
  146. data/lib/brakeman/tracker/collection.rb +93 -0
  147. data/lib/brakeman/tracker/config.rb +101 -0
  148. data/lib/brakeman/tracker/constants.rb +101 -0
  149. data/lib/brakeman/tracker/controller.rb +161 -0
  150. data/lib/brakeman/tracker/library.rb +17 -0
  151. data/lib/brakeman/tracker/model.rb +90 -0
  152. data/lib/brakeman/tracker/template.rb +33 -0
  153. data/lib/brakeman/util.rb +481 -0
  154. data/lib/brakeman/version.rb +3 -0
  155. data/lib/brakeman/warning.rb +255 -0
  156. data/lib/brakeman/warning_codes.rb +111 -0
  157. data/lib/ruby_parser/bm_sexp.rb +610 -0
  158. data/lib/ruby_parser/bm_sexp_processor.rb +116 -0
  159. metadata +362 -0
@@ -0,0 +1,107 @@
1
+ Brakeman.load_brakeman_dependency 'terminal-table'
2
+
3
+ class Brakeman::Report::Table < Brakeman::Report::Base
4
+ def generate_report
5
+ out = text_header <<
6
+ "\n\n+SUMMARY+\n\n" <<
7
+ truncate_table(generate_overview.to_s) << "\n\n" <<
8
+ truncate_table(generate_warning_overview.to_s) << "\n"
9
+
10
+ #Return output early if only summarizing
11
+ return out if tracker.options[:summary_only]
12
+
13
+ if tracker.options[:report_routes] or tracker.options[:debug]
14
+ out << "\n+CONTROLLERS+\n" <<
15
+ truncate_table(generate_controllers.to_s) << "\n"
16
+ end
17
+
18
+ if tracker.options[:debug]
19
+ out << "\n+TEMPLATES+\n\n" <<
20
+ truncate_table(generate_templates.to_s) << "\n"
21
+ end
22
+
23
+ res = generate_errors
24
+ out << "+Errors+\n" << truncate_table(res.to_s) if res
25
+
26
+ res = generate_warnings
27
+ out << "\n\n+SECURITY WARNINGS+\n\n" << truncate_table(res.to_s) if res
28
+
29
+ res = generate_controller_warnings
30
+ out << "\n\n\nController Warnings:\n\n" << truncate_table(res.to_s) if res
31
+
32
+ res = generate_model_warnings
33
+ out << "\n\n\nModel Warnings:\n\n" << truncate_table(res.to_s) if res
34
+
35
+ res = generate_template_warnings
36
+ out << "\n\nView Warnings:\n\n" << truncate_table(res.to_s) if res
37
+
38
+ out << "\n"
39
+ out
40
+ end
41
+
42
+ def generate_overview
43
+ num_warnings = all_warnings.length
44
+
45
+ Terminal::Table.new(:headings => ['Scanned/Reported', 'Total']) do |t|
46
+ t.add_row ['Controllers', tracker.controllers.length]
47
+ t.add_row ['Models', tracker.models.length - 1]
48
+ t.add_row ['Templates', number_of_templates(@tracker)]
49
+ t.add_row ['Errors', tracker.errors.length]
50
+ t.add_row ['Security Warnings', "#{num_warnings} (#{warnings_summary[:high_confidence]})"]
51
+ t.add_row ['Ignored Warnings', ignored_warnings.length] unless ignored_warnings.empty?
52
+ end
53
+ end
54
+
55
+ #Generate listings of templates and their output
56
+ def generate_templates
57
+ out_processor = Brakeman::OutputProcessor.new
58
+ template_rows = {}
59
+ tracker.templates.each do |name, template|
60
+ template.each_output do |out|
61
+ out = out_processor.format out
62
+ template_rows[name] ||= []
63
+ template_rows[name] << out.gsub("\n", ";").gsub(/\s+/, " ")
64
+ end
65
+ end
66
+
67
+ template_rows = template_rows.sort_by{|name, value| name.to_s}
68
+
69
+ output = ''
70
+ template_rows.each do |template|
71
+ output << template.first.to_s << "\n\n"
72
+ table = Terminal::Table.new(:headings => ['Output']) do |t|
73
+ # template[1] is an array of calls
74
+ template[1].each do |v|
75
+ t.add_row [v]
76
+ end
77
+ end
78
+
79
+ output << table.to_s << "\n\n"
80
+ end
81
+
82
+ output
83
+ end
84
+
85
+ def render_array template, headings, value_array, locals
86
+ return if value_array.empty?
87
+
88
+ Terminal::Table.new(:headings => headings) do |t|
89
+ value_array.each { |value_row| t.add_row value_row }
90
+ end
91
+ end
92
+
93
+ #Generate header for text output
94
+ def text_header
95
+ <<-HEADER
96
+
97
+ +BRAKEMAN REPORT+
98
+
99
+ Application path: #{tracker.app_path}
100
+ Rails version: #{rails_version}
101
+ Brakeman version: #{Brakeman::Version}
102
+ Started at #{tracker.start_time}
103
+ Duration: #{tracker.duration} seconds
104
+ Checks run: #{checks.checks_run.sort.join(", ")}
105
+ HEADER
106
+ end
107
+ end
@@ -0,0 +1,17 @@
1
+ #Generated tab-separated output suitable for the Jenkins Brakeman Plugin:
2
+ #https://github.com/presidentbeef/brakeman-jenkins-plugin
3
+ class Brakeman::Report::Tabs < Brakeman::Report::Base
4
+ def generate_report
5
+ [[:generic_warnings, "General"], [:controller_warnings, "Controller"],
6
+ [:model_warnings, "Model"], [:template_warnings, "Template"]].map do |meth, category|
7
+
8
+ self.send(meth).map do |w|
9
+ line = w.line || 0
10
+ w.warning_type.gsub!(/[^\w\s]/, ' ')
11
+ "#{warning_file(w, :absolute)}\t#{line}\t#{w.warning_type}\t#{category}\t#{w.format_message}\t#{TEXT_CONFIDENCE[w.confidence]}"
12
+ end.join "\n"
13
+
14
+ end.join "\n"
15
+
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ <h2>Controllers</h2>
2
+
3
+ <table>
4
+ <thead>
5
+ <tr>
6
+ <th>Name</th>
7
+ <th>Parent</th>
8
+ <th>Includes</th>
9
+ <th>Routes</th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <% controller_rows.each do |row| %>
14
+ <tr>
15
+ <td><%= row['Name'] %></td>
16
+ <td><%= row['Parent'] %></td>
17
+ <td><%= row['Includes'] %></td>
18
+ <td><%= row['Routes'] %></td>
19
+ </tr>
20
+ <% end %>
21
+ </tbody>
22
+ </table>
@@ -0,0 +1,21 @@
1
+ <p>Controller Warnings</p>
2
+ <table>
3
+ <thead>
4
+ <tr>
5
+ <th>Confidence</th>
6
+ <th>Controller</th>
7
+ <th>Warning Type</th>
8
+ <th>Message</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% warnings.each do |warning| %>
13
+ <tr>
14
+ <td><%= warning['Confidence']%></td>
15
+ <td><%= warning['Controller']%></td>
16
+ <td><%= warning['Warning Type']%></td>
17
+ <td><%= warning['Message']%></td>
18
+ </tr>
19
+ <% end %>
20
+ </tbody>
21
+ </table>
@@ -0,0 +1,29 @@
1
+ <div onClick="toggle('errors_table');"> <h2>Exceptions raised during the analysis (click to see them)</h2 ></div>
2
+ <div>
3
+ <div id='errors_table' style='display:none'>
4
+ <table>
5
+ <thead>
6
+ <tr>
7
+ <th>Error</th>
8
+ <th>Location</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% tracker.errors.each do |warning| %>
13
+ <tr>
14
+ <td><%= CGI.escapeHTML warning[:error] %></td>
15
+ <td>
16
+ <% if tracker.options[:debug] %>
17
+ <% warning[:backtrace].each do |line| %>
18
+ <%= line %><br/>
19
+ <% end %>
20
+ <% else %>
21
+ <%= warning[:backtrace][0] %>
22
+ <% end %>
23
+ </td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
28
+ </div>
29
+ </div>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE HTML SYSTEM>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Brakeman Report</title>
6
+ <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
7
+ <script type="text/javascript" src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>
8
+ <script type="text/javascript">
9
+ function toggle(context) {
10
+ var elem = document.getElementById(context);
11
+
12
+ if (elem.style.display != "block")
13
+ elem.style.display = "block";
14
+ else
15
+ elem.style.display = "none";
16
+
17
+ elem.parentNode.scrollIntoView();
18
+ }
19
+
20
+ $(document).ready(function() {
21
+ $('table').DataTable({
22
+ searching: false,
23
+ paging: false,
24
+ info: false
25
+ });
26
+ });
27
+ </script>
28
+ <style>
29
+ <%= css %>
30
+ </style>
31
+ </head>
32
+ <body>
33
+
34
+ <h1>Brakeman Report</h1>
35
+ <table>
36
+ <thead>
37
+ <tr>
38
+ <th>Application Path</th>
39
+ <th>Rails Version</th>
40
+ <th>Brakeman Version</th>
41
+ <th>Report Time</th>
42
+ <th>Checks Performed</th>
43
+ </tr>
44
+ </thead>
45
+ <tbody>
46
+ <tr>
47
+ <td><%= tracker.app_path %></td>
48
+ <td><%= rails_version %></td>
49
+ <td><%= brakeman_version %>
50
+ <td>
51
+ <%= tracker.start_time %><br><br>
52
+ <%= tracker.duration %> seconds
53
+ </td>
54
+ <td><%= checks.checks_run.sort.join(", ") %></td>
55
+ </tr>
56
+ </tbody>
57
+ </table>
58
+ <br>
@@ -0,0 +1,25 @@
1
+ <div onClick="toggle('ignored_table');"> <h2><%= warnings.length %> Ignored Warnings (click to see them)</h2 ></div>
2
+ <div>
3
+ <table style="display:none" id="ignored_table">
4
+ <thead>
5
+ <tr>
6
+ <th>Confidence</th>
7
+ <th>File</th>
8
+ <th>Warning Type</th>
9
+ <th>Message</th>
10
+ <th>Note</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <% warnings.each do |warning| %>
15
+ <tr>
16
+ <td><%= warning['Confidence']%></td>
17
+ <td><%= warning['File']%></td>
18
+ <td><%= warning['Warning Type']%></td>
19
+ <td><%= warning['Message']%></td>
20
+ <td><%= warning['Note']%></td>
21
+ </tr>
22
+ <% end %>
23
+ </tbody>
24
+ </table>
25
+ </div>
@@ -0,0 +1,21 @@
1
+ <p>Model Warnings</p>
2
+ <table>
3
+ <thead>
4
+ <tr>
5
+ <th>Confidence</th>
6
+ <th>Model</th>
7
+ <th>Warning Type</th>
8
+ <th>Message</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% warnings.each do |warning| %>
13
+ <tr>
14
+ <td><%= warning['Confidence']%></td>
15
+ <td><%= warning['Model']%></td>
16
+ <td><%= warning['Warning Type']%></td>
17
+ <td><%= warning['Message']%></td>
18
+ </tr>
19
+ <% end %>
20
+ </tbody>
21
+ </table>
@@ -0,0 +1,38 @@
1
+ <h2 id='summary'>Summary</h2>
2
+ <table>
3
+ <thead>
4
+ <tr>
5
+ <th>Scanned/Reported</th>
6
+ <th>Total</th>
7
+ </tr>
8
+ </thead>
9
+ <tbody>
10
+ <tr>
11
+ <td>Controllers</td>
12
+ <td><%= tracker.controllers.length %></td>
13
+ </tr>
14
+ <tr>
15
+ <td>Models</td>
16
+ <td><%= tracker.models.length - 1 %></td>
17
+ </tr>
18
+ <tr>
19
+ <td>Templates</td>
20
+ <td><%= number_of_templates %></td>
21
+ </tr>
22
+ <tr>
23
+ <td>Errors</td>
24
+ <td><%= tracker.errors.length %></td>
25
+ </tr>
26
+ <tr>
27
+ <td>Security Warnings</td>
28
+ <td><%= warnings %> <span class='high-confidence'>(<%= warnings_summary[:high_confidence] %>)</span></td>
29
+ </tr>
30
+ <% if warnings_summary['Ignored Warnings'] %>
31
+ <tr>
32
+ <td>Ignored Warnings</td>
33
+ <td><%= ignored_warnings %></td>
34
+ </tr>
35
+ <% end %>
36
+ </tbody>
37
+ </table>
38
+ <br>
@@ -0,0 +1,23 @@
1
+ <h2>Security Warnings</h2>
2
+ <table>
3
+ <thead>
4
+ <tr>
5
+ <th>Confidence</th>
6
+ <th>Class</th>
7
+ <th>Method</th>
8
+ <th>Warning Type</th>
9
+ <th>Message</th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <% warnings.each do |warning| %>
14
+ <tr>
15
+ <td><%= warning['Confidence']%></td>
16
+ <td><%= warning['Class']%></td>
17
+ <td><%= warning['Method']%></td>
18
+ <td><%= warning['Warning Type']%></td>
19
+ <td><%= warning['Message']%></td>
20
+ </tr>
21
+ <% end %>
22
+ </tbody>
23
+ </table>
@@ -0,0 +1,21 @@
1
+ <h2>Templates</h2>
2
+
3
+ <% template_rows.each do |template| %>
4
+
5
+ <p><%= template[0] %></p>
6
+ <table>
7
+ <thead>
8
+ <tr>
9
+ <th>Output</th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <% template[1].each do |call| %>
14
+ <tr>
15
+ <td><%= call %></td>
16
+ </tr>
17
+ <% end %>
18
+ </tbody>
19
+ </table>
20
+
21
+ <% end %>
@@ -0,0 +1,34 @@
1
+ <p>View Warnings</p>
2
+ <table>
3
+ <thead>
4
+ <tr>
5
+ <th>Confidence</th>
6
+ <th>Template</th>
7
+ <th>Warning Type</th>
8
+ <th>Message</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% warnings.each_with_index do |warning, i| %>
13
+ <tr>
14
+ <td><%= warning['Confidence']%></td>
15
+ <td>
16
+ <% if warning['Called From'] and warning['Called From'].length > 1 %>
17
+ <div class="template_name" onClick="toggle('callers<%= i %>')" >
18
+ <div>
19
+ <%= warning['Template'] %>
20
+ </div>
21
+ <div class="render_path" id="callers<%= i %>" >
22
+ <%= warning['Called From'].join(' &rarr; ') %> &rarr; <%= warning['Template Name'] %>
23
+ </div>
24
+ </div>
25
+ <% else %>
26
+ <%= warning['Template']%>
27
+ <% end %>
28
+ </td>
29
+ <td><%= warning['Warning Type']%></td>
30
+ <td><%= warning['Message']%></td>
31
+ </tr>
32
+ <% end %>
33
+ </tbody>
34
+ </table>
@@ -0,0 +1,17 @@
1
+ <table>
2
+ <thead>
3
+ <tr>
4
+ <th>Warning Type</th>
5
+ <th>Total</th>
6
+ </tr>
7
+ </thead>
8
+ <tbody>
9
+ <% types.sort.each do |warning_type| %>
10
+ <tr>
11
+ <td><%= warning_type %></td>
12
+ <td><%= warnings_summary[warning_type] %></td>
13
+ </tr>
14
+ <% end %>
15
+ </tbody>
16
+ </table>
17
+ <br>