inch 0.5.0.rc3 → 0.5.0.rc4

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 (259) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +15 -0
  3. data/.rubocop_todo.yml +94 -0
  4. data/CHANGELOG.md +26 -2
  5. data/Gemfile +5 -2
  6. data/README.md +3 -3
  7. data/Rakefile +6 -2
  8. data/bin/inch +3 -3
  9. data/config/{example.yml → .inch.yml.sample} +1 -0
  10. data/config/base.rb +53 -0
  11. data/config/elixir.rb +43 -0
  12. data/config/nodejs.rb +10 -0
  13. data/config/{defaults.rb → ruby.rb} +5 -54
  14. data/inch.gemspec +7 -7
  15. data/lib/inch.rb +14 -9
  16. data/lib/inch/api.rb +10 -10
  17. data/lib/inch/api/compare.rb +2 -2
  18. data/lib/inch/api/compare/code_objects.rb +2 -3
  19. data/lib/inch/api/compare/codebases.rb +1 -1
  20. data/lib/inch/api/diff.rb +13 -16
  21. data/lib/inch/api/filter.rb +1 -1
  22. data/lib/inch/api/get.rb +2 -2
  23. data/lib/inch/api/options/base.rb +4 -4
  24. data/lib/inch/api/options/filter.rb +0 -4
  25. data/lib/inch/api/options/suggest.rb +2 -6
  26. data/lib/inch/api/stats.rb +0 -1
  27. data/lib/inch/api/suggest.rb +9 -10
  28. data/lib/inch/cli.rb +6 -6
  29. data/lib/inch/cli/arguments.rb +2 -2
  30. data/lib/inch/cli/command.rb +15 -15
  31. data/lib/inch/cli/command/base.rb +30 -9
  32. data/lib/inch/cli/command/base_list.rb +2 -2
  33. data/lib/inch/cli/command/console.rb +5 -5
  34. data/lib/inch/cli/command/diff.rb +9 -9
  35. data/lib/inch/cli/command/inspect.rb +5 -4
  36. data/lib/inch/cli/command/list.rb +4 -4
  37. data/lib/inch/cli/command/options/base.rb +17 -16
  38. data/lib/inch/cli/command/options/base_list.rb +9 -5
  39. data/lib/inch/cli/command/options/console.rb +4 -3
  40. data/lib/inch/cli/command/options/diff.rb +8 -6
  41. data/lib/inch/cli/command/options/inspect.rb +2 -2
  42. data/lib/inch/cli/command/options/list.rb +3 -2
  43. data/lib/inch/cli/command/options/show.rb +2 -2
  44. data/lib/inch/cli/command/options/stats.rb +2 -1
  45. data/lib/inch/cli/command/options/suggest.rb +6 -3
  46. data/lib/inch/cli/command/output/base.rb +4 -6
  47. data/lib/inch/cli/command/output/console.rb +6 -7
  48. data/lib/inch/cli/command/output/diff.rb +6 -6
  49. data/lib/inch/cli/command/output/inspect.rb +6 -8
  50. data/lib/inch/cli/command/output/list.rb +0 -1
  51. data/lib/inch/cli/command/output/show.rb +4 -5
  52. data/lib/inch/cli/command/output/stats.rb +21 -21
  53. data/lib/inch/cli/command/output/suggest.rb +31 -28
  54. data/lib/inch/cli/command/show.rb +4 -4
  55. data/lib/inch/cli/command/stats.rb +4 -4
  56. data/lib/inch/cli/command/suggest.rb +6 -6
  57. data/lib/inch/cli/command_parser.rb +6 -5
  58. data/lib/inch/cli/sparkline_helper.rb +6 -6
  59. data/lib/inch/cli/trace_helper.rb +1 -1
  60. data/lib/inch/cli/yardopts_helper.rb +4 -3
  61. data/lib/inch/code_object.rb +3 -3
  62. data/lib/inch/code_object/converter.rb +6 -8
  63. data/lib/inch/code_object/provider.rb +11 -11
  64. data/lib/inch/code_object/proxy.rb +61 -30
  65. data/lib/inch/codebase.rb +7 -8
  66. data/lib/inch/codebase/object.rb +60 -0
  67. data/lib/inch/codebase/objects.rb +8 -10
  68. data/lib/inch/codebase/objects_filter.rb +7 -5
  69. data/lib/inch/codebase/proxy.rb +4 -4
  70. data/lib/inch/codebase/serializer.rb +3 -3
  71. data/lib/inch/config.rb +42 -11
  72. data/lib/inch/config/base.rb +8 -29
  73. data/lib/inch/config/codebase.rb +32 -7
  74. data/lib/inch/config/evaluation.rb +61 -0
  75. data/lib/inch/core_ext.rb +1 -1
  76. data/lib/inch/core_ext/string.rb +1 -1
  77. data/lib/inch/evaluation.rb +13 -21
  78. data/lib/inch/evaluation/file.rb +4 -2
  79. data/lib/inch/evaluation/grade_list.rb +4 -4
  80. data/lib/inch/evaluation/priority_range.rb +3 -0
  81. data/lib/inch/evaluation/proxy.rb +139 -14
  82. data/lib/inch/evaluation/role.rb +99 -0
  83. data/lib/inch/language.rb +3 -0
  84. data/lib/inch/language/elixir/code_object/base.rb +197 -0
  85. data/lib/inch/language/elixir/code_object/function_object.rb +74 -0
  86. data/lib/inch/language/elixir/code_object/module_object.rb +23 -0
  87. data/lib/inch/language/elixir/code_object/type_object.rb +11 -0
  88. data/lib/inch/language/elixir/evaluation/base.rb +28 -0
  89. data/lib/inch/language/elixir/evaluation/function_object.rb +31 -0
  90. data/lib/inch/language/elixir/evaluation/module_object.rb +27 -0
  91. data/lib/inch/language/elixir/evaluation/type_object.rb +11 -0
  92. data/lib/inch/language/elixir/import.rb +24 -0
  93. data/lib/inch/language/elixir/provider/reader.rb +19 -0
  94. data/lib/inch/language/elixir/provider/reader/object.rb +63 -0
  95. data/lib/inch/language/elixir/provider/reader/object/base.rb +191 -0
  96. data/lib/inch/language/elixir/provider/reader/object/function_object.rb +26 -0
  97. data/lib/inch/language/elixir/provider/reader/object/module_object.rb +22 -0
  98. data/lib/inch/language/elixir/provider/reader/object/type_object.rb +15 -0
  99. data/lib/inch/language/elixir/provider/reader/parser.rb +55 -0
  100. data/lib/inch/language/elixir/roles/base.rb +32 -0
  101. data/lib/inch/language/elixir/roles/function.rb +112 -0
  102. data/lib/inch/language/elixir/roles/module.rb +64 -0
  103. data/lib/inch/language/elixir/roles/object.rb +76 -0
  104. data/lib/inch/language/elixir/roles/type.rb +13 -0
  105. data/lib/inch/language/nodejs/import.rb +8 -0
  106. data/lib/inch/language/nodejs/provider/jsdoc.rb +19 -0
  107. data/lib/inch/language/nodejs/provider/jsdoc/object.rb +55 -0
  108. data/lib/inch/language/nodejs/provider/jsdoc/object/base.rb +191 -0
  109. data/lib/inch/language/nodejs/provider/jsdoc/parser.rb +59 -0
  110. data/lib/inch/language/ruby/code_object/base.rb +197 -0
  111. data/lib/inch/language/ruby/code_object/class_object.rb +10 -0
  112. data/lib/inch/language/ruby/code_object/class_variable_object.rb +10 -0
  113. data/lib/inch/language/ruby/code_object/constant_object.rb +10 -0
  114. data/lib/inch/language/ruby/code_object/method_object.rb +85 -0
  115. data/lib/inch/language/ruby/code_object/method_parameter_object.rb +64 -0
  116. data/lib/inch/language/ruby/code_object/module_object.rb +10 -0
  117. data/lib/inch/language/ruby/code_object/namespace_object.rb +35 -0
  118. data/lib/inch/language/ruby/evaluation/base.rb +45 -0
  119. data/lib/inch/language/ruby/evaluation/class_object.rb +10 -0
  120. data/lib/inch/language/ruby/evaluation/class_variable_object.rb +21 -0
  121. data/lib/inch/language/ruby/evaluation/constant_object.rb +21 -0
  122. data/lib/inch/language/ruby/evaluation/method_object.rb +74 -0
  123. data/lib/inch/language/ruby/evaluation/module_object.rb +10 -0
  124. data/lib/inch/language/ruby/evaluation/namespace_object.rb +30 -0
  125. data/lib/inch/language/ruby/import.rb +34 -0
  126. data/lib/inch/language/ruby/provider/yard.rb +58 -0
  127. data/lib/inch/language/ruby/provider/yard/docstring.rb +162 -0
  128. data/lib/inch/language/ruby/provider/yard/nodoc_helper.rb +97 -0
  129. data/lib/inch/language/ruby/provider/yard/object.rb +63 -0
  130. data/lib/inch/language/ruby/provider/yard/object/base.rb +325 -0
  131. data/lib/inch/language/ruby/provider/yard/object/class_object.rb +14 -0
  132. data/lib/inch/language/ruby/provider/yard/object/class_variable_object.rb +14 -0
  133. data/lib/inch/language/ruby/provider/yard/object/constant_object.rb +14 -0
  134. data/lib/inch/language/ruby/provider/yard/object/method_object.rb +170 -0
  135. data/lib/inch/language/ruby/provider/yard/object/method_parameter_object.rb +94 -0
  136. data/lib/inch/language/ruby/provider/yard/object/method_signature.rb +120 -0
  137. data/lib/inch/language/ruby/provider/yard/object/module_object.rb +14 -0
  138. data/lib/inch/language/ruby/provider/yard/object/namespace_object.rb +46 -0
  139. data/lib/inch/language/ruby/provider/yard/object/root_object.rb +14 -0
  140. data/lib/inch/language/ruby/provider/yard/parser.rb +71 -0
  141. data/lib/inch/language/ruby/roles/base.rb +17 -0
  142. data/lib/inch/language/ruby/roles/class_variable.rb +53 -0
  143. data/lib/inch/language/ruby/roles/constant.rb +53 -0
  144. data/lib/inch/language/ruby/roles/method.rb +112 -0
  145. data/lib/inch/language/ruby/roles/method_parameter.rb +84 -0
  146. data/lib/inch/language/ruby/roles/missing.rb +24 -0
  147. data/lib/inch/language/ruby/roles/namespace.rb +89 -0
  148. data/lib/inch/language/ruby/roles/object.rb +120 -0
  149. data/lib/inch/rake.rb +2 -2
  150. data/lib/inch/rake/suggest.rb +7 -2
  151. data/lib/inch/utils/buffered_ui.rb +16 -0
  152. data/lib/inch/utils/shell_helper.rb +1 -1
  153. data/lib/inch/utils/ui.rb +5 -5
  154. data/lib/inch/utils/weighted_list.rb +2 -3
  155. data/lib/inch/version.rb +1 -1
  156. data/test/fixtures/{code_examples → ruby/code_examples}/lib/foo.rb +0 -0
  157. data/test/fixtures/{diff1 → ruby/diff1}/lib/diff1.rb +0 -0
  158. data/test/fixtures/{diff2 → ruby/diff2}/lib/diff2.rb +0 -0
  159. data/test/fixtures/{inch-yml → ruby/inch-yml}/.inch.yml +0 -0
  160. data/test/fixtures/{inch-yml → ruby/inch-yml}/foo/bar.rb +0 -0
  161. data/test/fixtures/{inch-yml → ruby/inch-yml}/foo/vendor/base.rb +0 -0
  162. data/test/fixtures/{parameters → ruby/parameters}/lib/foo.rb +0 -0
  163. data/test/fixtures/{readme → ruby/readme}/lib/foo.rb +0 -0
  164. data/test/fixtures/{really_good → ruby/really_good}/lib/foo.rb +0 -0
  165. data/test/fixtures/{really_good_pedantic → ruby/really_good_pedantic}/lib/foo.rb +0 -0
  166. data/test/fixtures/{simple → ruby/simple}/README +0 -0
  167. data/test/fixtures/{simple → ruby/simple}/lib/broken.rb +11 -19
  168. data/test/fixtures/ruby/simple/lib/broken_ruby_2_0_features.rb +7 -0
  169. data/test/fixtures/ruby/simple/lib/directives.rb +8 -0
  170. data/test/fixtures/{simple → ruby/simple}/lib/foo.rb +22 -1
  171. data/test/fixtures/{simple → ruby/simple}/lib/nodoc.rb +0 -0
  172. data/test/fixtures/{simple → ruby/simple}/lib/role_methods.rb +0 -0
  173. data/test/fixtures/{simple → ruby/simple}/lib/role_namespaces.rb +0 -0
  174. data/test/fixtures/{visibility → ruby/visibility}/lib/foo.rb +0 -0
  175. data/test/fixtures/{yardopts → ruby/yardopts}/.yardopts +0 -0
  176. data/test/fixtures/{yardopts → ruby/yardopts}/foo/bar.rb +0 -0
  177. data/test/integration/api/compare/codebases.rb +3 -3
  178. data/test/integration/cli/command/console_test.rb +6 -6
  179. data/test/integration/cli/command/diff_test.rb +62 -0
  180. data/test/integration/cli/command/inspect_test.rb +5 -6
  181. data/test/integration/cli/command/list_test.rb +4 -5
  182. data/test/integration/cli/command/show_test.rb +5 -5
  183. data/test/integration/cli/command/stats_test.rb +3 -3
  184. data/test/integration/cli/command/suggest_test.rb +13 -13
  185. data/test/integration/stats_options_test.rb +4 -4
  186. data/test/integration/visibility_options_test.rb +14 -14
  187. data/test/shared/base_list.rb +4 -3
  188. data/test/test_helper.rb +13 -13
  189. data/test/unit/api/filter_test.rb +7 -7
  190. data/test/unit/api/get_test.rb +1 -1
  191. data/test/unit/api/list_test.rb +1 -1
  192. data/test/unit/api/options/base_test.rb +3 -3
  193. data/test/unit/api/stats_test.rb +1 -1
  194. data/test/unit/api/suggest_test.rb +3 -3
  195. data/test/unit/cli/arguments_test.rb +2 -2
  196. data/test/unit/cli/command/base_test.rb +1 -1
  197. data/test/unit/cli/command/options/base_list_test.rb +2 -2
  198. data/test/unit/cli/command/options/base_object_test.rb +1 -1
  199. data/test/unit/cli/command/options/base_test.rb +1 -1
  200. data/test/unit/cli/command_parser_test.rb +3 -3
  201. data/test/unit/cli/trace_helper_test.rb +1 -1
  202. data/test/unit/cli/yardopts_helper_test.rb +6 -5
  203. data/test/unit/code_object/converter_test.rb +1 -1
  204. data/test/unit/code_object/provider_test.rb +2 -2
  205. data/test/unit/code_object/proxy_test.rb +2 -2
  206. data/test/unit/codebase/objects_test.rb +2 -2
  207. data/test/unit/codebase/proxy_test.rb +7 -5
  208. data/test/unit/config/codebase_test.rb +4 -4
  209. data/test/unit/config_test.rb +28 -0
  210. data/test/unit/evaluation/{role/base_test.rb → role_test.rb} +7 -7
  211. data/test/unit/{code_object/proxy → language/ruby/code_object}/method_object_test.rb +66 -21
  212. data/test/unit/{code_object → language/ruby}/provider/yard/docstring_test.rb +74 -38
  213. data/test/unit/{code_object → language/ruby}/provider/yard/nodoc_helper_test.rb +9 -7
  214. data/test/unit/{code_object → language/ruby}/provider/yard/object/method_object_test.rb +21 -11
  215. data/test/unit/language/ruby/provider/yard_test.rb +25 -0
  216. data/test/unit/utils/buffered_ui_test.rb +48 -0
  217. data/test/unit/utils/ui_test.rb +7 -7
  218. data/test/unit/utils/weighted_list_test.rb +7 -4
  219. metadata +139 -93
  220. data/lib/inch/code_object/provider/yard.rb +0 -57
  221. data/lib/inch/code_object/provider/yard/docstring.rb +0 -133
  222. data/lib/inch/code_object/provider/yard/nodoc_helper.rb +0 -93
  223. data/lib/inch/code_object/provider/yard/object.rb +0 -60
  224. data/lib/inch/code_object/provider/yard/object/base.rb +0 -302
  225. data/lib/inch/code_object/provider/yard/object/class_object.rb +0 -12
  226. data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +0 -12
  227. data/lib/inch/code_object/provider/yard/object/constant_object.rb +0 -12
  228. data/lib/inch/code_object/provider/yard/object/method_object.rb +0 -153
  229. data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +0 -88
  230. data/lib/inch/code_object/provider/yard/object/method_signature.rb +0 -114
  231. data/lib/inch/code_object/provider/yard/object/module_object.rb +0 -12
  232. data/lib/inch/code_object/provider/yard/object/namespace_object.rb +0 -47
  233. data/lib/inch/code_object/provider/yard/object/root_object.rb +0 -12
  234. data/lib/inch/code_object/provider/yard/parser.rb +0 -62
  235. data/lib/inch/code_object/proxy/base.rb +0 -241
  236. data/lib/inch/code_object/proxy/class_object.rb +0 -8
  237. data/lib/inch/code_object/proxy/class_variable_object.rb +0 -8
  238. data/lib/inch/code_object/proxy/constant_object.rb +0 -8
  239. data/lib/inch/code_object/proxy/method_object.rb +0 -82
  240. data/lib/inch/code_object/proxy/method_parameter_object.rb +0 -60
  241. data/lib/inch/code_object/proxy/module_object.rb +0 -8
  242. data/lib/inch/code_object/proxy/namespace_object.rb +0 -33
  243. data/lib/inch/evaluation/object_schema.rb +0 -30
  244. data/lib/inch/evaluation/proxy/base.rb +0 -164
  245. data/lib/inch/evaluation/proxy/class_object.rb +0 -8
  246. data/lib/inch/evaluation/proxy/class_variable_object.rb +0 -19
  247. data/lib/inch/evaluation/proxy/constant_object.rb +0 -19
  248. data/lib/inch/evaluation/proxy/method_object.rb +0 -65
  249. data/lib/inch/evaluation/proxy/module_object.rb +0 -8
  250. data/lib/inch/evaluation/proxy/namespace_object.rb +0 -27
  251. data/lib/inch/evaluation/role/base.rb +0 -92
  252. data/lib/inch/evaluation/role/class_variable.rb +0 -55
  253. data/lib/inch/evaluation/role/constant.rb +0 -55
  254. data/lib/inch/evaluation/role/method.rb +0 -126
  255. data/lib/inch/evaluation/role/method_parameter.rb +0 -91
  256. data/lib/inch/evaluation/role/missing.rb +0 -20
  257. data/lib/inch/evaluation/role/namespace.rb +0 -85
  258. data/lib/inch/evaluation/role/object.rb +0 -143
  259. data/test/unit/code_object/provider/yard_test.rb +0 -25
@@ -1,55 +0,0 @@
1
- module Inch
2
- module Evaluation
3
- module Role
4
- # Roles assigned to class variables
5
- module ClassVariable
6
- class WithDoc < Object::WithDoc
7
- applicable_if :has_doc?
8
- end
9
- class WithoutDoc < Object::WithoutDoc
10
- applicable_unless :has_doc?
11
- end
12
-
13
- class TaggedAsNodoc < Object::TaggedAsNodoc
14
- applicable_if :nodoc?
15
- end
16
- class InRoot < Object::InRoot
17
- applicable_if :in_root?
18
- end
19
-
20
- class Public < Object::Public
21
- applicable_if :public?
22
-
23
- def priority
24
- -1
25
- end
26
- end
27
- class Private < Object::Private
28
- applicable_if :private?
29
-
30
- def priority
31
- -3
32
- end
33
- end
34
-
35
- class WithCodeExample < Object::WithCodeExample
36
- applicable_if do |o|
37
- o.has_code_example? && !o.has_multiple_code_examples?
38
- end
39
- end
40
-
41
- class WithMultipleCodeExamples < Object::WithMultipleCodeExamples
42
- applicable_if :has_multiple_code_examples?
43
- end
44
-
45
- class WithoutCodeExample < Object::WithoutCodeExample
46
- applicable_unless :has_code_example?
47
-
48
- def suggestion
49
- nil
50
- end
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,55 +0,0 @@
1
- module Inch
2
- module Evaluation
3
- module Role
4
- # Roles assigned to constants
5
- module Constant
6
- class WithDoc < Object::WithDoc
7
- applicable_if :has_doc?
8
- end
9
- class WithoutDoc < Object::WithoutDoc
10
- applicable_unless :has_doc?
11
- end
12
-
13
- class TaggedAsNodoc < Object::TaggedAsNodoc
14
- applicable_if :nodoc?
15
- end
16
- class InRoot < Object::InRoot
17
- applicable_if :in_root?
18
- end
19
-
20
- class Public < Object::Public
21
- applicable_if :public?
22
-
23
- def priority
24
- -1
25
- end
26
- end
27
- class Private < Object::Private
28
- applicable_if :private?
29
-
30
- def priority
31
- -3
32
- end
33
- end
34
-
35
- class WithCodeExample < Object::WithCodeExample
36
- applicable_if do |o|
37
- o.has_code_example? && !o.has_multiple_code_examples?
38
- end
39
- end
40
-
41
- class WithMultipleCodeExamples < Object::WithMultipleCodeExamples
42
- applicable_if :has_multiple_code_examples?
43
- end
44
-
45
- class WithoutCodeExample < Object::WithoutCodeExample
46
- applicable_unless :has_code_example?
47
-
48
- def suggestion
49
- nil
50
- end
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,126 +0,0 @@
1
- module Inch
2
- module Evaluation
3
- module Role
4
- module Method
5
- # Role assigned to methods without parameters
6
- class WithoutParameters < Base
7
- applicable_unless :has_parameters?
8
- end
9
-
10
- # Role assigned to methods with many parameters
11
- #
12
- # @see CodeObject::Proxy::MethodObject#has_many_parameters?
13
- class WithManyParameters < Base
14
- applicable_if :has_many_parameters?
15
-
16
- def priority
17
- +2
18
- end
19
- end
20
-
21
- # Role assigned to methods where the return value is typed in the docs
22
- class WithReturnType < Base
23
- applicable_if :return_typed?
24
- end
25
-
26
- # Role assigned to methods where the return value is not typed
27
- class WithoutReturnType < Missing
28
- applicable_unless :return_typed?
29
-
30
- def suggestion
31
- "Describe what '#{object.name}' returns"
32
- end
33
- end
34
-
35
- # Role assigned to methods where the return value is decribed in the docs
36
- class WithReturnDescription < Base
37
- applicable_if :return_described?
38
- end
39
-
40
- # Role assigned to methods where the return value is not decribed
41
- class WithoutReturnDescription < Missing
42
- applicable_unless :return_described?
43
-
44
- def suggestion
45
- "Describe what '#{object.name}' returns"
46
- end
47
- end
48
-
49
-
50
- # Role assigned to methods with many lines
51
- #
52
- # @see CodeObject::Proxy::MethodObject#has_many_lines?
53
- class WithManyLines < Base
54
- applicable_if :has_many_lines?
55
-
56
- def priority
57
- +2
58
- end
59
- end
60
-
61
- # Role assigned to methods whose name end in a '!'
62
- class WithBangName < Base
63
- applicable_if :bang_name?
64
-
65
- def priority
66
- +3
67
- end
68
- end
69
-
70
- # Role assigned to methods whose name end in a '?'
71
- class WithQuestioningName < Base
72
- applicable_if :questioning_name?
73
-
74
- def priority
75
- -4
76
- end
77
- end
78
-
79
- # Role assigned to methods which are aliased
80
- class HasAlias < Base
81
- applicable_if :has_alias?
82
-
83
- def priority
84
- +2
85
- end
86
- end
87
-
88
- # Role assigned to methods that are constructors
89
- class Constructor < Base
90
- applicable_if :constructor?
91
- end
92
-
93
- # Role assigned to methods that are getters
94
- class Getter < Base
95
- applicable_if :getter?
96
- end
97
-
98
- # Role assigned to methods that are setters
99
- class Setter < Base
100
- applicable_if :setter?
101
- end
102
-
103
- # Role assigned to methods that are overriding another method
104
- class Overridden < Base
105
- applicable_if :overridden?
106
-
107
- # It seems more important to document the overridden method,
108
- # than the overriding one
109
- def priority
110
- -2
111
- end
112
-
113
- # This role doesnot assign a score.
114
- def score
115
- nil
116
- end
117
-
118
- # This role sets a min_score.
119
- def min_score
120
- @value.to_f
121
- end
122
- end
123
- end
124
- end
125
- end
126
- end
@@ -1,91 +0,0 @@
1
- module Inch
2
- module Evaluation
3
- module Role
4
- # Roles assigned to method parameters
5
- #
6
- # @note The +object+ is a MethodParameterObject here!
7
- module MethodParameter
8
- # Role assigned to parameters that are mentioned in the docs
9
- #
10
- # @see CodeObject::Proxy::MethodParameterObject#mentioned?
11
- class WithMention < Base
12
- applicable_if :mentioned?
13
- end
14
-
15
- # Role assigned to parameters that are not mentioned in the docs
16
- #
17
- # @see CodeObject::Proxy::MethodParameterObject#mentioned?
18
- class WithoutMention < Missing
19
- applicable_unless :mentioned?
20
-
21
- def suggestion
22
- "Describe the parameter '#{object.name}'"
23
- end
24
- end
25
-
26
- # Role assigned to parameters that are typed in the docs
27
- #
28
- # @see CodeObject::Proxy::MethodParameterObject#typed?
29
- class WithType < Base
30
- applicable_if :typed?
31
- end
32
-
33
- # Role assigned to parameters that are not typed in the docs
34
- #
35
- # @see CodeObject::Proxy::MethodParameterObject#typed?
36
- class WithoutType < Missing
37
- applicable_unless :typed?
38
- end
39
-
40
- # Role assigned to parameters that are spalts, e.g. +*args+
41
- #
42
- # @see CodeObject::Proxy::MethodParameterObject#splat?
43
- class Splat < Base
44
- applicable_if :splat?
45
-
46
- def priority
47
- +1
48
- end
49
- end
50
-
51
- # Role assigned to parameters that are blocks, e.g. +&block+
52
- #
53
- # @see CodeObject::Proxy::MethodParameterObject#block?
54
- class Block < Base
55
- applicable_if :block?
56
-
57
- def priority
58
- +1
59
- end
60
- end
61
-
62
- # Role assigned to parameters that are documented, but not part of
63
- # the method signature
64
- #
65
- # @see CodeObject::Proxy::MethodParameterObject#wrongly_mentioned?
66
- class WithWrongMention < Base
67
- applicable_if :wrongly_mentioned?
68
-
69
- def suggestion
70
- "The parameter '#{object.name}' seems not to be part of the signature."
71
- end
72
-
73
- def priority
74
- +1
75
- end
76
- end
77
-
78
- # Role assigned to parameters that have a 'bad' name
79
- #
80
- # @see CodeObject::Proxy::MethodParameterObject#bad_name?
81
- class WithBadName < Base
82
- applicable_if :bad_name?
83
-
84
- def priority
85
- +1
86
- end
87
- end
88
- end
89
- end
90
- end
91
- end
@@ -1,20 +0,0 @@
1
- module Inch
2
- module Evaluation
3
- module Role
4
- # Missing is the base class for things that can be improved in the doc
5
- #
6
- class Missing < Base
7
- def score
8
- nil
9
- end
10
-
11
- # @return [Fixnum]
12
- # a score that can be achieved by adding the missing thing mentioned
13
- # by the role
14
- def potential_score
15
- @value.to_i
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,85 +0,0 @@
1
- module Inch
2
- module Evaluation
3
- module Role
4
- # Roles assigned to namespaces (classes and modules)
5
- module Namespace
6
- # Role assigned to namespaces with children
7
- #
8
- # @see CodeObject::Proxy::NamespaceObject#has_children?
9
- class WithChildren < Base
10
- applicable_if :has_children?
11
-
12
- # This role doesnot assign a score.
13
- def score
14
- 0
15
- end
16
-
17
- # This role sets a max_score.
18
- def max_score
19
- # @value.to_f
20
- end
21
- end
22
-
23
- # Role assigned to namespaces with many children
24
- #
25
- # @see CodeObject::Proxy::NamespaceObject#has_many_children?
26
- class WithManyChildren < Base
27
- applicable_if :has_many_children?
28
-
29
- # +priority
30
- def priority
31
- +1
32
- end
33
- end
34
-
35
- # Role assigned to namespaces with many attributes
36
- #
37
- # @see CodeObject::Proxy::NamespaceObject#has_many_attributes?
38
- class WithManyAttributes < Base
39
- applicable_if :has_many_attributes?
40
-
41
- # +priority
42
- def priority
43
- +1
44
- end
45
- end
46
-
47
- # Role assigned to namespaces without any children
48
- class WithoutChildren < Base
49
- applicable_unless :has_children?
50
- end
51
-
52
- # Role assigned to namespaces without any methods
53
- class WithoutMethods < Base
54
- applicable_unless :has_methods?
55
-
56
- def priority
57
- -2
58
- end
59
- end
60
-
61
- # A 'pure' namespace has only namespaces as children
62
- class Pure < Base
63
- applicable_if :pure_namespace?
64
-
65
- def priority
66
- -2
67
- end
68
- end
69
-
70
- # A 'core' namespace is a class or module that is part of the Ruby
71
- # core. It might appear in the object tree when monkey-patching
72
- # functionality.
73
- # (the reasoning here is: just because we patch Hash does not mean
74
- # we need to document the Hash class itself)
75
- class Core < Base
76
- applicable_if :core?
77
-
78
- def priority
79
- -7
80
- end
81
- end
82
- end
83
- end
84
- end
85
- end
@@ -1,143 +0,0 @@
1
- module Inch
2
- module Evaluation
3
- module Role
4
- # Roles assigned to all objects
5
- module Object
6
- # Role assigned to objects that are aliases.
7
- #
8
- class Alias < Base
9
- applicable_if :alias?
10
-
11
- def priority
12
- # not sure about this yet,
13
- # but aliases should not show up high in the reports
14
- -7
15
- end
16
- end
17
-
18
- # Role assigned to objects with a describing comment (docstring)
19
- class WithDoc < Base
20
- applicable_if :has_doc?
21
- end
22
-
23
- # Role assigned to objects without a docstring
24
- class WithoutDoc < Missing
25
- applicable_unless :has_doc?
26
-
27
- def suggestion
28
- "Add a comment describing the #{object_type}"
29
- end
30
- end
31
-
32
- # Tagged means tagged in an unconsidred way, i.e. YARD tags not
33
- # considered by Inch. Since these tags are parsed from the docstring
34
- # the object seems undocumented to Inch.
35
- class Tagged < Base
36
- applicable_if :has_unconsidered_tags?
37
-
38
- def priority
39
- -1
40
- end
41
- end
42
-
43
- # Role assigned to objects explicitly or implicitly tagged not to be
44
- # documented.
45
- #
46
- # @see CodeObject::NodocHelper
47
- class TaggedAsNodoc < Base
48
- applicable_if :nodoc?
49
-
50
- def priority
51
- -7
52
- end
53
- end
54
-
55
- # Role assigned to objects explicitly or implicitly tagged to be part
56
- # of an API. If the API is 'private'/'internal' TaggedAsInternalAPI is assigned
57
- # instead.
58
- class TaggedAsAPI < Base
59
- applicable_if :api_tag?
60
- end
61
-
62
- # Role assigned to objects explicitly or implicitly tagged to be part
63
- # of a private API.
64
- class TaggedAsInternalAPI < Base
65
- applicable_if :tagged_as_internal_api?
66
-
67
- def priority
68
- -5
69
- end
70
- end
71
-
72
- # Role assigned to objects explicitly or implicitly tagged to be
73
- # private.
74
- #
75
- # @see CodeObject::NodocHelper
76
- class TaggedAsPrivate < Base
77
- applicable_if :tagged_as_private?
78
-
79
- def priority
80
- -5
81
- end
82
- end
83
-
84
- # Role assigned to objects declared in the top-level namespace
85
- class InRoot < Base
86
- applicable_if :in_root?
87
-
88
- def priority
89
- +3
90
- end
91
- end
92
-
93
- # Role assigned to public objects
94
- class Public < Base
95
- applicable_if :public?
96
-
97
- def priority
98
- +2
99
- end
100
- end
101
-
102
- # Role assigned to protected objects
103
- class Protected < Base
104
- applicable_if :protected?
105
-
106
- def priority
107
- +1
108
- end
109
- end
110
-
111
- # Role assigned to private objects
112
- class Private < Base
113
- applicable_if :private?
114
-
115
- def priority
116
- -2
117
- end
118
- end
119
-
120
- # Role assigned to objects with a single code example
121
- class WithCodeExample < Base
122
- applicable_if do |o|
123
- o.has_code_example? && !o.has_multiple_code_examples?
124
- end
125
- end
126
-
127
- # Role assigned to objects with multiple code examples
128
- class WithMultipleCodeExamples < Base
129
- applicable_if :has_multiple_code_examples?
130
- end
131
-
132
- # Role assigned to objects without a code example
133
- class WithoutCodeExample < Missing
134
- applicable_unless :has_code_example?
135
-
136
- def suggestion
137
- "Add a code example (optional)"
138
- end
139
- end
140
- end
141
- end
142
- end
143
- end