super-quick-rb 0.0.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.
Files changed (218) hide show
  1. checksums.yaml +7 -0
  2. data/rdoc-8.0.0/CONTRIBUTING.md +195 -0
  3. data/rdoc-8.0.0/CVE-2013-0256.rdoc +49 -0
  4. data/rdoc-8.0.0/History.rdoc +1668 -0
  5. data/rdoc-8.0.0/LEGAL.rdoc +56 -0
  6. data/rdoc-8.0.0/LICENSE.rdoc +63 -0
  7. data/rdoc-8.0.0/README.md +236 -0
  8. data/rdoc-8.0.0/RI.md +842 -0
  9. data/rdoc-8.0.0/TODO.rdoc +60 -0
  10. data/rdoc-8.0.0/doc/markup_reference/markdown.md +659 -0
  11. data/rdoc-8.0.0/doc/markup_reference/rdoc.rdoc +1169 -0
  12. data/rdoc-8.0.0/exe/rdoc +43 -0
  13. data/rdoc-8.0.0/exe/ri +12 -0
  14. data/rdoc-8.0.0/lib/rdoc/code_object/alias.rb +98 -0
  15. data/rdoc-8.0.0/lib/rdoc/code_object/any_method.rb +387 -0
  16. data/rdoc-8.0.0/lib/rdoc/code_object/attr.rb +178 -0
  17. data/rdoc-8.0.0/lib/rdoc/code_object/class_module.rb +969 -0
  18. data/rdoc-8.0.0/lib/rdoc/code_object/constant.rb +221 -0
  19. data/rdoc-8.0.0/lib/rdoc/code_object/context/section.rb +182 -0
  20. data/rdoc-8.0.0/lib/rdoc/code_object/context.rb +1238 -0
  21. data/rdoc-8.0.0/lib/rdoc/code_object/extend.rb +9 -0
  22. data/rdoc-8.0.0/lib/rdoc/code_object/include.rb +9 -0
  23. data/rdoc-8.0.0/lib/rdoc/code_object/method_attr.rb +417 -0
  24. data/rdoc-8.0.0/lib/rdoc/code_object/mixin.rb +123 -0
  25. data/rdoc-8.0.0/lib/rdoc/code_object/normal_class.rb +92 -0
  26. data/rdoc-8.0.0/lib/rdoc/code_object/normal_module.rb +73 -0
  27. data/rdoc-8.0.0/lib/rdoc/code_object/require.rb +51 -0
  28. data/rdoc-8.0.0/lib/rdoc/code_object/single_class.rb +30 -0
  29. data/rdoc-8.0.0/lib/rdoc/code_object/top_level.rb +286 -0
  30. data/rdoc-8.0.0/lib/rdoc/code_object.rb +393 -0
  31. data/rdoc-8.0.0/lib/rdoc/code_objects.rb +5 -0
  32. data/rdoc-8.0.0/lib/rdoc/comment.rb +353 -0
  33. data/rdoc-8.0.0/lib/rdoc/cross_reference.rb +215 -0
  34. data/rdoc-8.0.0/lib/rdoc/encoding.rb +120 -0
  35. data/rdoc-8.0.0/lib/rdoc/erb_partial.rb +18 -0
  36. data/rdoc-8.0.0/lib/rdoc/erbio.rb +37 -0
  37. data/rdoc-8.0.0/lib/rdoc/generator/aliki.rb +200 -0
  38. data/rdoc-8.0.0/lib/rdoc/generator/darkfish.rb +824 -0
  39. data/rdoc-8.0.0/lib/rdoc/generator/json_index.rb +284 -0
  40. data/rdoc-8.0.0/lib/rdoc/generator/markup.rb +196 -0
  41. data/rdoc-8.0.0/lib/rdoc/generator/pot/message_extractor.rb +68 -0
  42. data/rdoc-8.0.0/lib/rdoc/generator/pot/po.rb +84 -0
  43. data/rdoc-8.0.0/lib/rdoc/generator/pot/po_entry.rb +141 -0
  44. data/rdoc-8.0.0/lib/rdoc/generator/pot.rb +94 -0
  45. data/rdoc-8.0.0/lib/rdoc/generator/ri.rb +30 -0
  46. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
  47. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  48. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  49. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_head.rhtml +163 -0
  50. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  51. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  52. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  53. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  54. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +27 -0
  55. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +27 -0
  56. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  57. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  58. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  59. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  60. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  61. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  62. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/class.rhtml +230 -0
  63. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/css/rdoc.css +2181 -0
  64. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  65. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/aliki.js +513 -0
  66. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  67. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  68. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
  69. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  70. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  71. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  72. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  73. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  74. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  75. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  76. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_head.rhtml +43 -0
  77. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +5 -0
  78. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +17 -0
  79. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +17 -0
  80. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +16 -0
  81. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +21 -0
  82. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +11 -0
  83. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +32 -0
  84. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +6 -0
  85. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +15 -0
  86. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +11 -0
  87. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +39 -0
  88. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  89. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/class.rhtml +220 -0
  90. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/fonts.css +167 -0
  91. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/rdoc.css +701 -0
  92. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
  93. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
  94. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
  95. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
  96. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  97. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  98. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  99. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  100. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  101. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  102. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  103. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  104. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  105. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  106. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  107. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  108. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  109. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  110. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  111. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  112. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  113. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  114. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  115. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  116. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  117. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  118. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  119. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  120. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  121. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  122. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  123. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/index.rhtml +24 -0
  124. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/darkfish.js +140 -0
  125. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/search.js +120 -0
  126. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/page.rhtml +19 -0
  127. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +21 -0
  128. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +65 -0
  129. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +72 -0
  130. data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/navigation.js +105 -0
  131. data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/searcher.js +271 -0
  132. data/rdoc-8.0.0/lib/rdoc/generator.rb +52 -0
  133. data/rdoc-8.0.0/lib/rdoc/i18n/locale.rb +102 -0
  134. data/rdoc-8.0.0/lib/rdoc/i18n/text.rb +126 -0
  135. data/rdoc-8.0.0/lib/rdoc/i18n.rb +10 -0
  136. data/rdoc-8.0.0/lib/rdoc/known_classes.rb +74 -0
  137. data/rdoc-8.0.0/lib/rdoc/markdown/entities.rb +2131 -0
  138. data/rdoc-8.0.0/lib/rdoc/markdown/literals.kpeg +21 -0
  139. data/rdoc-8.0.0/lib/rdoc/markdown/literals.rb +454 -0
  140. data/rdoc-8.0.0/lib/rdoc/markdown.kpeg +1315 -0
  141. data/rdoc-8.0.0/lib/rdoc/markdown.rb +16865 -0
  142. data/rdoc-8.0.0/lib/rdoc/markup/blank_line.rb +29 -0
  143. data/rdoc-8.0.0/lib/rdoc/markup/block_quote.rb +14 -0
  144. data/rdoc-8.0.0/lib/rdoc/markup/document.rb +164 -0
  145. data/rdoc-8.0.0/lib/rdoc/markup/element.rb +21 -0
  146. data/rdoc-8.0.0/lib/rdoc/markup/formatter.rb +285 -0
  147. data/rdoc-8.0.0/lib/rdoc/markup/hard_break.rb +34 -0
  148. data/rdoc-8.0.0/lib/rdoc/markup/heading.rb +170 -0
  149. data/rdoc-8.0.0/lib/rdoc/markup/include.rb +42 -0
  150. data/rdoc-8.0.0/lib/rdoc/markup/indented_paragraph.rb +47 -0
  151. data/rdoc-8.0.0/lib/rdoc/markup/inline_parser.rb +312 -0
  152. data/rdoc-8.0.0/lib/rdoc/markup/list.rb +101 -0
  153. data/rdoc-8.0.0/lib/rdoc/markup/list_item.rb +99 -0
  154. data/rdoc-8.0.0/lib/rdoc/markup/paragraph.rb +28 -0
  155. data/rdoc-8.0.0/lib/rdoc/markup/parser.rb +585 -0
  156. data/rdoc-8.0.0/lib/rdoc/markup/pre_process.rb +317 -0
  157. data/rdoc-8.0.0/lib/rdoc/markup/raw.rb +66 -0
  158. data/rdoc-8.0.0/lib/rdoc/markup/rule.rb +20 -0
  159. data/rdoc-8.0.0/lib/rdoc/markup/table.rb +64 -0
  160. data/rdoc-8.0.0/lib/rdoc/markup/to_ansi.rb +144 -0
  161. data/rdoc-8.0.0/lib/rdoc/markup/to_bs.rb +86 -0
  162. data/rdoc-8.0.0/lib/rdoc/markup/to_html.rb +682 -0
  163. data/rdoc-8.0.0/lib/rdoc/markup/to_html_crossref.rb +261 -0
  164. data/rdoc-8.0.0/lib/rdoc/markup/to_html_snippet.rb +287 -0
  165. data/rdoc-8.0.0/lib/rdoc/markup/to_joined_paragraph.rb +41 -0
  166. data/rdoc-8.0.0/lib/rdoc/markup/to_label.rb +84 -0
  167. data/rdoc-8.0.0/lib/rdoc/markup/to_markdown.rb +215 -0
  168. data/rdoc-8.0.0/lib/rdoc/markup/to_rdoc.rb +421 -0
  169. data/rdoc-8.0.0/lib/rdoc/markup/to_table_of_contents.rb +88 -0
  170. data/rdoc-8.0.0/lib/rdoc/markup/to_test.rb +77 -0
  171. data/rdoc-8.0.0/lib/rdoc/markup/to_tt_only.rb +107 -0
  172. data/rdoc-8.0.0/lib/rdoc/markup/verbatim.rb +83 -0
  173. data/rdoc-8.0.0/lib/rdoc/markup.rb +219 -0
  174. data/rdoc-8.0.0/lib/rdoc/options.rb +1412 -0
  175. data/rdoc-8.0.0/lib/rdoc/parser/c.rb +1227 -0
  176. data/rdoc-8.0.0/lib/rdoc/parser/changelog.rb +379 -0
  177. data/rdoc-8.0.0/lib/rdoc/parser/markdown.rb +22 -0
  178. data/rdoc-8.0.0/lib/rdoc/parser/rbs.rb +275 -0
  179. data/rdoc-8.0.0/lib/rdoc/parser/rd.rb +22 -0
  180. data/rdoc-8.0.0/lib/rdoc/parser/ruby.rb +1266 -0
  181. data/rdoc-8.0.0/lib/rdoc/parser/ruby_colorizer.rb +253 -0
  182. data/rdoc-8.0.0/lib/rdoc/parser/simple.rb +44 -0
  183. data/rdoc-8.0.0/lib/rdoc/parser/text.rb +11 -0
  184. data/rdoc-8.0.0/lib/rdoc/parser.rb +298 -0
  185. data/rdoc-8.0.0/lib/rdoc/rbs_helper.rb +186 -0
  186. data/rdoc-8.0.0/lib/rdoc/rd/block_parser.rb +1706 -0
  187. data/rdoc-8.0.0/lib/rdoc/rd/block_parser.ry +643 -0
  188. data/rdoc-8.0.0/lib/rdoc/rd/inline.rb +71 -0
  189. data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.rb +1854 -0
  190. data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.ry +593 -0
  191. data/rdoc-8.0.0/lib/rdoc/rd.rb +99 -0
  192. data/rdoc-8.0.0/lib/rdoc/rdoc.rb +724 -0
  193. data/rdoc-8.0.0/lib/rdoc/ri/driver.rb +1572 -0
  194. data/rdoc-8.0.0/lib/rdoc/ri/formatter.rb +6 -0
  195. data/rdoc-8.0.0/lib/rdoc/ri/paths.rb +171 -0
  196. data/rdoc-8.0.0/lib/rdoc/ri/servlet.rb +452 -0
  197. data/rdoc-8.0.0/lib/rdoc/ri/store.rb +6 -0
  198. data/rdoc-8.0.0/lib/rdoc/ri/task.rb +71 -0
  199. data/rdoc-8.0.0/lib/rdoc/ri.rb +21 -0
  200. data/rdoc-8.0.0/lib/rdoc/rubygems_hook.rb +327 -0
  201. data/rdoc-8.0.0/lib/rdoc/server.rb +460 -0
  202. data/rdoc-8.0.0/lib/rdoc/stats/normal.rb +58 -0
  203. data/rdoc-8.0.0/lib/rdoc/stats/quiet.rb +59 -0
  204. data/rdoc-8.0.0/lib/rdoc/stats/verbose.rb +44 -0
  205. data/rdoc-8.0.0/lib/rdoc/stats.rb +484 -0
  206. data/rdoc-8.0.0/lib/rdoc/store.rb +1205 -0
  207. data/rdoc-8.0.0/lib/rdoc/task.rb +355 -0
  208. data/rdoc-8.0.0/lib/rdoc/text.rb +244 -0
  209. data/rdoc-8.0.0/lib/rdoc/token_stream.rb +104 -0
  210. data/rdoc-8.0.0/lib/rdoc/tom_doc.rb +257 -0
  211. data/rdoc-8.0.0/lib/rdoc/version.rb +10 -0
  212. data/rdoc-8.0.0/lib/rdoc.rb +239 -0
  213. data/rdoc-8.0.0/lib/rubygems_plugin.rb +14 -0
  214. data/rdoc-8.0.0/man/ri.1 +249 -0
  215. data/rdoc-8.0.0/rdoc-logo.svg +43 -0
  216. data/rdoc-8.0.0/rdoc.gemspec +74 -0
  217. data/super-quick-rb.gemspec +12 -0
  218. metadata +257 -0
@@ -0,0 +1,484 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # RDoc statistics collector which prints a summary and report of a project's
4
+ # documentation totals.
5
+
6
+ class RDoc::Stats
7
+
8
+ include RDoc::Text
9
+
10
+ ##
11
+ # Display order for item types in the coverage report
12
+
13
+ TYPE_ORDER = %w[Class Module Constant Attribute Method].freeze
14
+
15
+ ##
16
+ # Message displayed when all items are documented
17
+
18
+ GREAT_JOB_MESSAGE = <<~MSG
19
+ 100% documentation!
20
+ Great Job!
21
+ MSG
22
+
23
+ ##
24
+ # Output level for the coverage report
25
+
26
+ attr_reader :coverage_level
27
+
28
+ ##
29
+ # Count of files parsed during parsing
30
+
31
+ attr_reader :files_so_far
32
+
33
+ ##
34
+ # Total number of files found
35
+
36
+ attr_reader :num_files
37
+
38
+ ##
39
+ # Creates a new Stats that will have +num_files+. +verbosity+ defaults to 1
40
+ # which will create an RDoc::Stats::Normal outputter.
41
+
42
+ def initialize(store, num_files, verbosity = 1)
43
+ @num_files = num_files
44
+ @store = store
45
+
46
+ @coverage_level = 0
47
+ @doc_items = nil
48
+ @files_so_far = 0
49
+ @fully_documented = false
50
+ @num_params = 0
51
+ @percent_doc = nil
52
+ @start = Time.now
53
+ @undoc_params = 0
54
+
55
+ self.verbosity = verbosity
56
+ end
57
+
58
+ ##
59
+ # Sets the verbosity level, rebuilding the display outputter.
60
+
61
+ def verbosity=(verbosity)
62
+ @display = case verbosity
63
+ when 0 then Quiet.new @num_files
64
+ when 1 then Normal.new @num_files
65
+ else Verbose.new @num_files
66
+ end
67
+ end
68
+
69
+ ##
70
+ # Records the parsing of an alias +as+.
71
+
72
+ def add_alias(as)
73
+ @display.print_alias as
74
+ end
75
+
76
+ ##
77
+ # Records the parsing of an attribute +attribute+
78
+
79
+ def add_attribute(attribute)
80
+ @display.print_attribute attribute
81
+ end
82
+
83
+ ##
84
+ # Records the parsing of a class +klass+
85
+
86
+ def add_class(klass)
87
+ @display.print_class klass
88
+ end
89
+
90
+ ##
91
+ # Records the parsing of +constant+
92
+
93
+ def add_constant(constant)
94
+ @display.print_constant constant
95
+ end
96
+
97
+ ##
98
+ # Records the parsing of +file+
99
+
100
+ def add_file(file)
101
+ @files_so_far += 1
102
+ @display.print_file @files_so_far, file
103
+ end
104
+
105
+ ##
106
+ # Records the parsing of +method+
107
+
108
+ def add_method(method)
109
+ @display.print_method method
110
+ end
111
+
112
+ ##
113
+ # Records the parsing of a module +mod+
114
+
115
+ def add_module(mod)
116
+ @display.print_module mod
117
+ end
118
+
119
+ ##
120
+ # Call this to mark the beginning of parsing for display purposes
121
+
122
+ def begin_adding
123
+ @display.begin_adding
124
+ end
125
+
126
+ ##
127
+ # Calculates documentation totals and percentages for classes, modules,
128
+ # constants, attributes and methods.
129
+
130
+ def calculate
131
+ return if @doc_items
132
+
133
+ ucm = @store.unique_classes_and_modules
134
+
135
+ classes = @store.unique_classes.reject { |cm| cm.full_name == 'Object' }
136
+
137
+ constants = []
138
+ ucm.each { |cm| constants.concat cm.constants }
139
+
140
+ methods = []
141
+ ucm.each { |cm| methods.concat cm.method_list }
142
+
143
+ attributes = []
144
+ ucm.each { |cm| attributes.concat cm.attributes }
145
+
146
+ @num_attributes, @undoc_attributes = doc_stats attributes
147
+ @num_classes, @undoc_classes = doc_stats classes
148
+ @num_constants, @undoc_constants = doc_stats constants
149
+ @num_methods, @undoc_methods = doc_stats methods
150
+ @num_modules, @undoc_modules = doc_stats @store.unique_modules
151
+
152
+ @num_items =
153
+ @num_attributes +
154
+ @num_classes +
155
+ @num_constants +
156
+ @num_methods +
157
+ @num_modules +
158
+ @num_params
159
+
160
+ @undoc_items =
161
+ @undoc_attributes +
162
+ @undoc_classes +
163
+ @undoc_constants +
164
+ @undoc_methods +
165
+ @undoc_modules +
166
+ @undoc_params
167
+
168
+ @doc_items = @num_items - @undoc_items
169
+ end
170
+
171
+ ##
172
+ # Sets coverage report level. Accepted values are:
173
+ #
174
+ # false or nil:: No report
175
+ # 0:: Classes, modules, constants, attributes, methods
176
+ # 1:: Level 0 + method parameters
177
+
178
+ def coverage_level=(level)
179
+ level = -1 unless level
180
+
181
+ @coverage_level = level
182
+ end
183
+
184
+ ##
185
+ # Returns the length and number of undocumented items in +collection+.
186
+
187
+ def doc_stats(collection)
188
+ visible = collection.select { |item| item.display? }
189
+ [visible.length, visible.count { |item| not item.documented? }]
190
+ end
191
+
192
+ ##
193
+ # Call this to mark the end of parsing for display purposes
194
+
195
+ def done_adding
196
+ @display.done_adding
197
+ end
198
+
199
+ ##
200
+ # The documentation status of this project. +true+ when 100%, +false+ when
201
+ # less than 100% and +nil+ when unknown.
202
+ #
203
+ # Set by calling #calculate
204
+
205
+ def fully_documented?
206
+ @fully_documented
207
+ end
208
+
209
+ ##
210
+ # Calculates the percentage of items documented.
211
+
212
+ def percent_doc
213
+ return @percent_doc if @percent_doc
214
+
215
+ @fully_documented = (@num_items - @doc_items) == 0
216
+
217
+ @percent_doc = @doc_items.to_f / @num_items * 100 if @num_items.nonzero?
218
+ @percent_doc ||= 0
219
+
220
+ @percent_doc
221
+ end
222
+
223
+ ##
224
+ # Returns a report on which items are not documented
225
+
226
+ def report
227
+ if @coverage_level > 0 then
228
+ extend RDoc::Text
229
+ end
230
+
231
+ if @coverage_level.zero? then
232
+ calculate
233
+
234
+ return GREAT_JOB_MESSAGE if @num_items == @doc_items
235
+ end
236
+
237
+ items, empty_classes = collect_undocumented_items
238
+
239
+ if @coverage_level > 0 then
240
+ calculate
241
+
242
+ return GREAT_JOB_MESSAGE if @num_items == @doc_items
243
+ end
244
+
245
+ report = +""
246
+ report << "The following items are not documented:\n\n"
247
+
248
+ # Referenced-but-empty classes
249
+ empty_classes.each do |cm|
250
+ report << "#{cm.full_name} is referenced but empty.\n"
251
+ report << "It probably came from another project. I'm sorry I'm holding it against you.\n\n"
252
+ end
253
+
254
+ # Group items by file, then by type
255
+ by_file = items.group_by { |item| item[:file] }
256
+
257
+ by_file.sort_by { |file, _| file }.each do |file, file_items|
258
+ report << "#{file}:\n"
259
+
260
+ by_type = file_items.group_by { |item| item[:type] }
261
+
262
+ TYPE_ORDER.each do |type|
263
+ next unless by_type[type]
264
+
265
+ report << " #{type}:\n"
266
+
267
+ sorted = by_type[type].sort_by { |item| [item[:line] || 0, item[:name]] }
268
+ name_width = sorted.reduce(0) { |max, item| item[:line] && item[:name].length > max ? item[:name].length : max }
269
+
270
+ sorted.each do |item|
271
+ if item[:line]
272
+ report << " %-*s %s:%d\n" % [name_width, item[:name], item[:file], item[:line]]
273
+ else
274
+ report << " #{item[:name]}\n"
275
+ end
276
+
277
+ if item[:undoc_params]
278
+ report << " Undocumented params: #{item[:undoc_params].join(', ')}\n"
279
+ end
280
+ end
281
+ end
282
+
283
+ report << "\n"
284
+ end
285
+
286
+ report
287
+ end
288
+
289
+ ##
290
+ # Collects all undocumented items across all classes and modules.
291
+ # Returns [items, empty_classes] where items is an Array of Hashes
292
+ # with keys :type, :name, :file, :line, and empty_classes is an
293
+ # Array of ClassModule objects that are referenced but have no files.
294
+
295
+ def collect_undocumented_items
296
+ empty_classes = []
297
+ items = []
298
+
299
+ @store.unique_classes_and_modules.each do |class_module|
300
+ next unless class_module.display?
301
+
302
+ if class_module.in_files.empty?
303
+ empty_classes << class_module
304
+ next
305
+ end
306
+
307
+ unless class_module.documented? || class_module.full_name == 'Object'
308
+ collect_undocumented_class_module(class_module, items)
309
+ end
310
+
311
+ collect_undocumented_constants(class_module, items)
312
+ collect_undocumented_attributes(class_module, items)
313
+ collect_undocumented_methods(class_module, items)
314
+ end
315
+
316
+ [items, empty_classes]
317
+ end
318
+
319
+ ##
320
+ # Collects undocumented classes or modules from +class_module+ into +items+.
321
+ # Reopened classes/modules are reported in every file they appear in.
322
+
323
+ def collect_undocumented_class_module(class_module, items)
324
+ class_module.in_files.map(&:full_name).uniq.each do |file|
325
+ items << {
326
+ type: class_module.type.capitalize,
327
+ name: class_module.full_name,
328
+ file: file,
329
+ line: nil,
330
+ }
331
+ end
332
+ end
333
+
334
+ ##
335
+ # Collects undocumented constants from +class_module+ into +items+.
336
+
337
+ def collect_undocumented_constants(class_module, items)
338
+ class_module.constants.each do |constant|
339
+ next unless constant.display?
340
+ next if constant.documented? || constant.is_alias_for
341
+
342
+ file = constant.file&.full_name
343
+ next unless file
344
+
345
+ items << {
346
+ type: "Constant",
347
+ name: constant.full_name,
348
+ file: file,
349
+ line: constant.line,
350
+ }
351
+ end
352
+ end
353
+
354
+ ##
355
+ # Collects undocumented attributes from +class_module+ into +items+.
356
+
357
+ def collect_undocumented_attributes(class_module, items)
358
+ class_module.attributes.each do |attr|
359
+ next unless attr.display?
360
+ next if attr.documented?
361
+
362
+ file = attr.file&.full_name
363
+ next unless file
364
+
365
+ scope = attr.singleton ? "." : "#"
366
+ items << {
367
+ type: "Attribute",
368
+ name: "#{class_module.full_name}#{scope}#{attr.name}",
369
+ file: file,
370
+ line: attr.line,
371
+ }
372
+ end
373
+ end
374
+
375
+ ##
376
+ # Collects undocumented methods from +class_module+ into +items+.
377
+ # At coverage level > 0, also counts undocumented parameters.
378
+
379
+ def collect_undocumented_methods(class_module, items)
380
+ class_module.each_method do |method|
381
+ next unless method.display?
382
+ next if method.documented? && @coverage_level.zero?
383
+
384
+ undoc_param_names = nil
385
+
386
+ if @coverage_level > 0
387
+ params, undoc = undoc_params method
388
+ @num_params += params
389
+
390
+ unless undoc.empty?
391
+ @undoc_params += undoc.length
392
+ undoc_param_names = undoc
393
+ end
394
+ end
395
+
396
+ next if method.documented? && !undoc_param_names
397
+
398
+ file = method.file&.full_name
399
+ next unless file
400
+
401
+ scope = method.singleton ? "." : "#"
402
+ item = {
403
+ type: "Method",
404
+ name: "#{class_module.full_name}#{scope}#{method.name}",
405
+ file: file,
406
+ line: method.line,
407
+ }
408
+ item[:undoc_params] = undoc_param_names if undoc_param_names
409
+
410
+ items << item
411
+ end
412
+ end
413
+
414
+ ##
415
+ # Returns a summary of the collected statistics.
416
+
417
+ def summary
418
+ calculate
419
+
420
+ num_width = [@num_files, @num_items].max.to_s.length
421
+ undoc_width = [
422
+ @undoc_attributes,
423
+ @undoc_classes,
424
+ @undoc_constants,
425
+ @undoc_items,
426
+ @undoc_methods,
427
+ @undoc_modules,
428
+ @undoc_params,
429
+ ].max.to_s.length
430
+
431
+ report = +""
432
+
433
+ report << "Files: %*d\n" % [num_width, @num_files]
434
+ report << "\n"
435
+ report << "Classes: %*d (%*d undocumented)\n" % [
436
+ num_width, @num_classes, undoc_width, @undoc_classes]
437
+ report << "Modules: %*d (%*d undocumented)\n" % [
438
+ num_width, @num_modules, undoc_width, @undoc_modules]
439
+ report << "Constants: %*d (%*d undocumented)\n" % [
440
+ num_width, @num_constants, undoc_width, @undoc_constants]
441
+ report << "Attributes: %*d (%*d undocumented)\n" % [
442
+ num_width, @num_attributes, undoc_width, @undoc_attributes]
443
+ report << "Methods: %*d (%*d undocumented)\n" % [
444
+ num_width, @num_methods, undoc_width, @undoc_methods]
445
+ report << "Parameters: %*d (%*d undocumented)\n" % [
446
+ num_width, @num_params, undoc_width, @undoc_params] if
447
+ @coverage_level > 0
448
+ report << "\n"
449
+ report << "Total: %*d (%*d undocumented)\n" % [
450
+ num_width, @num_items, undoc_width, @undoc_items]
451
+ report << "%6.2f%% documented\n" % percent_doc
452
+ report << "\n"
453
+ report << "Elapsed: %0.1fs\n" % (Time.now - @start)
454
+
455
+ report
456
+ end
457
+
458
+ ##
459
+ # Determines which parameters in +method+ were not documented. Returns a
460
+ # total parameter count and an Array of undocumented methods.
461
+
462
+ def undoc_params(method)
463
+ @formatter ||= RDoc::Markup::ToTtOnly.new
464
+
465
+ params = method.param_list
466
+
467
+ params = params.map { |param| param.gsub(/^\*\*?/, '') }
468
+
469
+ return 0, [] if params.empty?
470
+
471
+ document = parse method.comment
472
+
473
+ tts = document.accept @formatter
474
+
475
+ undoc = params - tts
476
+
477
+ [params.length, undoc]
478
+ end
479
+
480
+ autoload :Quiet, "#{__dir__}/stats/quiet"
481
+ autoload :Normal, "#{__dir__}/stats/normal"
482
+ autoload :Verbose, "#{__dir__}/stats/verbose"
483
+
484
+ end