inch 0.5.0.rc3 → 0.5.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +15 -0
- data/.rubocop_todo.yml +94 -0
- data/CHANGELOG.md +26 -2
- data/Gemfile +5 -2
- data/README.md +3 -3
- data/Rakefile +6 -2
- data/bin/inch +3 -3
- data/config/{example.yml → .inch.yml.sample} +1 -0
- data/config/base.rb +53 -0
- data/config/elixir.rb +43 -0
- data/config/nodejs.rb +10 -0
- data/config/{defaults.rb → ruby.rb} +5 -54
- data/inch.gemspec +7 -7
- data/lib/inch.rb +14 -9
- data/lib/inch/api.rb +10 -10
- data/lib/inch/api/compare.rb +2 -2
- data/lib/inch/api/compare/code_objects.rb +2 -3
- data/lib/inch/api/compare/codebases.rb +1 -1
- data/lib/inch/api/diff.rb +13 -16
- data/lib/inch/api/filter.rb +1 -1
- data/lib/inch/api/get.rb +2 -2
- data/lib/inch/api/options/base.rb +4 -4
- data/lib/inch/api/options/filter.rb +0 -4
- data/lib/inch/api/options/suggest.rb +2 -6
- data/lib/inch/api/stats.rb +0 -1
- data/lib/inch/api/suggest.rb +9 -10
- data/lib/inch/cli.rb +6 -6
- data/lib/inch/cli/arguments.rb +2 -2
- data/lib/inch/cli/command.rb +15 -15
- data/lib/inch/cli/command/base.rb +30 -9
- data/lib/inch/cli/command/base_list.rb +2 -2
- data/lib/inch/cli/command/console.rb +5 -5
- data/lib/inch/cli/command/diff.rb +9 -9
- data/lib/inch/cli/command/inspect.rb +5 -4
- data/lib/inch/cli/command/list.rb +4 -4
- data/lib/inch/cli/command/options/base.rb +17 -16
- data/lib/inch/cli/command/options/base_list.rb +9 -5
- data/lib/inch/cli/command/options/console.rb +4 -3
- data/lib/inch/cli/command/options/diff.rb +8 -6
- data/lib/inch/cli/command/options/inspect.rb +2 -2
- data/lib/inch/cli/command/options/list.rb +3 -2
- data/lib/inch/cli/command/options/show.rb +2 -2
- data/lib/inch/cli/command/options/stats.rb +2 -1
- data/lib/inch/cli/command/options/suggest.rb +6 -3
- data/lib/inch/cli/command/output/base.rb +4 -6
- data/lib/inch/cli/command/output/console.rb +6 -7
- data/lib/inch/cli/command/output/diff.rb +6 -6
- data/lib/inch/cli/command/output/inspect.rb +6 -8
- data/lib/inch/cli/command/output/list.rb +0 -1
- data/lib/inch/cli/command/output/show.rb +4 -5
- data/lib/inch/cli/command/output/stats.rb +21 -21
- data/lib/inch/cli/command/output/suggest.rb +31 -28
- data/lib/inch/cli/command/show.rb +4 -4
- data/lib/inch/cli/command/stats.rb +4 -4
- data/lib/inch/cli/command/suggest.rb +6 -6
- data/lib/inch/cli/command_parser.rb +6 -5
- data/lib/inch/cli/sparkline_helper.rb +6 -6
- data/lib/inch/cli/trace_helper.rb +1 -1
- data/lib/inch/cli/yardopts_helper.rb +4 -3
- data/lib/inch/code_object.rb +3 -3
- data/lib/inch/code_object/converter.rb +6 -8
- data/lib/inch/code_object/provider.rb +11 -11
- data/lib/inch/code_object/proxy.rb +61 -30
- data/lib/inch/codebase.rb +7 -8
- data/lib/inch/codebase/object.rb +60 -0
- data/lib/inch/codebase/objects.rb +8 -10
- data/lib/inch/codebase/objects_filter.rb +7 -5
- data/lib/inch/codebase/proxy.rb +4 -4
- data/lib/inch/codebase/serializer.rb +3 -3
- data/lib/inch/config.rb +42 -11
- data/lib/inch/config/base.rb +8 -29
- data/lib/inch/config/codebase.rb +32 -7
- data/lib/inch/config/evaluation.rb +61 -0
- data/lib/inch/core_ext.rb +1 -1
- data/lib/inch/core_ext/string.rb +1 -1
- data/lib/inch/evaluation.rb +13 -21
- data/lib/inch/evaluation/file.rb +4 -2
- data/lib/inch/evaluation/grade_list.rb +4 -4
- data/lib/inch/evaluation/priority_range.rb +3 -0
- data/lib/inch/evaluation/proxy.rb +139 -14
- data/lib/inch/evaluation/role.rb +99 -0
- data/lib/inch/language.rb +3 -0
- data/lib/inch/language/elixir/code_object/base.rb +197 -0
- data/lib/inch/language/elixir/code_object/function_object.rb +74 -0
- data/lib/inch/language/elixir/code_object/module_object.rb +23 -0
- data/lib/inch/language/elixir/code_object/type_object.rb +11 -0
- data/lib/inch/language/elixir/evaluation/base.rb +28 -0
- data/lib/inch/language/elixir/evaluation/function_object.rb +31 -0
- data/lib/inch/language/elixir/evaluation/module_object.rb +27 -0
- data/lib/inch/language/elixir/evaluation/type_object.rb +11 -0
- data/lib/inch/language/elixir/import.rb +24 -0
- data/lib/inch/language/elixir/provider/reader.rb +19 -0
- data/lib/inch/language/elixir/provider/reader/object.rb +63 -0
- data/lib/inch/language/elixir/provider/reader/object/base.rb +191 -0
- data/lib/inch/language/elixir/provider/reader/object/function_object.rb +26 -0
- data/lib/inch/language/elixir/provider/reader/object/module_object.rb +22 -0
- data/lib/inch/language/elixir/provider/reader/object/type_object.rb +15 -0
- data/lib/inch/language/elixir/provider/reader/parser.rb +55 -0
- data/lib/inch/language/elixir/roles/base.rb +32 -0
- data/lib/inch/language/elixir/roles/function.rb +112 -0
- data/lib/inch/language/elixir/roles/module.rb +64 -0
- data/lib/inch/language/elixir/roles/object.rb +76 -0
- data/lib/inch/language/elixir/roles/type.rb +13 -0
- data/lib/inch/language/nodejs/import.rb +8 -0
- data/lib/inch/language/nodejs/provider/jsdoc.rb +19 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object.rb +55 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object/base.rb +191 -0
- data/lib/inch/language/nodejs/provider/jsdoc/parser.rb +59 -0
- data/lib/inch/language/ruby/code_object/base.rb +197 -0
- data/lib/inch/language/ruby/code_object/class_object.rb +10 -0
- data/lib/inch/language/ruby/code_object/class_variable_object.rb +10 -0
- data/lib/inch/language/ruby/code_object/constant_object.rb +10 -0
- data/lib/inch/language/ruby/code_object/method_object.rb +85 -0
- data/lib/inch/language/ruby/code_object/method_parameter_object.rb +64 -0
- data/lib/inch/language/ruby/code_object/module_object.rb +10 -0
- data/lib/inch/language/ruby/code_object/namespace_object.rb +35 -0
- data/lib/inch/language/ruby/evaluation/base.rb +45 -0
- data/lib/inch/language/ruby/evaluation/class_object.rb +10 -0
- data/lib/inch/language/ruby/evaluation/class_variable_object.rb +21 -0
- data/lib/inch/language/ruby/evaluation/constant_object.rb +21 -0
- data/lib/inch/language/ruby/evaluation/method_object.rb +74 -0
- data/lib/inch/language/ruby/evaluation/module_object.rb +10 -0
- data/lib/inch/language/ruby/evaluation/namespace_object.rb +30 -0
- data/lib/inch/language/ruby/import.rb +34 -0
- data/lib/inch/language/ruby/provider/yard.rb +58 -0
- data/lib/inch/language/ruby/provider/yard/docstring.rb +162 -0
- data/lib/inch/language/ruby/provider/yard/nodoc_helper.rb +97 -0
- data/lib/inch/language/ruby/provider/yard/object.rb +63 -0
- data/lib/inch/language/ruby/provider/yard/object/base.rb +325 -0
- data/lib/inch/language/ruby/provider/yard/object/class_object.rb +14 -0
- data/lib/inch/language/ruby/provider/yard/object/class_variable_object.rb +14 -0
- data/lib/inch/language/ruby/provider/yard/object/constant_object.rb +14 -0
- data/lib/inch/language/ruby/provider/yard/object/method_object.rb +170 -0
- data/lib/inch/language/ruby/provider/yard/object/method_parameter_object.rb +94 -0
- data/lib/inch/language/ruby/provider/yard/object/method_signature.rb +120 -0
- data/lib/inch/language/ruby/provider/yard/object/module_object.rb +14 -0
- data/lib/inch/language/ruby/provider/yard/object/namespace_object.rb +46 -0
- data/lib/inch/language/ruby/provider/yard/object/root_object.rb +14 -0
- data/lib/inch/language/ruby/provider/yard/parser.rb +71 -0
- data/lib/inch/language/ruby/roles/base.rb +17 -0
- data/lib/inch/language/ruby/roles/class_variable.rb +53 -0
- data/lib/inch/language/ruby/roles/constant.rb +53 -0
- data/lib/inch/language/ruby/roles/method.rb +112 -0
- data/lib/inch/language/ruby/roles/method_parameter.rb +84 -0
- data/lib/inch/language/ruby/roles/missing.rb +24 -0
- data/lib/inch/language/ruby/roles/namespace.rb +89 -0
- data/lib/inch/language/ruby/roles/object.rb +120 -0
- data/lib/inch/rake.rb +2 -2
- data/lib/inch/rake/suggest.rb +7 -2
- data/lib/inch/utils/buffered_ui.rb +16 -0
- data/lib/inch/utils/shell_helper.rb +1 -1
- data/lib/inch/utils/ui.rb +5 -5
- data/lib/inch/utils/weighted_list.rb +2 -3
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/{code_examples → ruby/code_examples}/lib/foo.rb +0 -0
- data/test/fixtures/{diff1 → ruby/diff1}/lib/diff1.rb +0 -0
- data/test/fixtures/{diff2 → ruby/diff2}/lib/diff2.rb +0 -0
- data/test/fixtures/{inch-yml → ruby/inch-yml}/.inch.yml +0 -0
- data/test/fixtures/{inch-yml → ruby/inch-yml}/foo/bar.rb +0 -0
- data/test/fixtures/{inch-yml → ruby/inch-yml}/foo/vendor/base.rb +0 -0
- data/test/fixtures/{parameters → ruby/parameters}/lib/foo.rb +0 -0
- data/test/fixtures/{readme → ruby/readme}/lib/foo.rb +0 -0
- data/test/fixtures/{really_good → ruby/really_good}/lib/foo.rb +0 -0
- data/test/fixtures/{really_good_pedantic → ruby/really_good_pedantic}/lib/foo.rb +0 -0
- data/test/fixtures/{simple → ruby/simple}/README +0 -0
- data/test/fixtures/{simple → ruby/simple}/lib/broken.rb +11 -19
- data/test/fixtures/ruby/simple/lib/broken_ruby_2_0_features.rb +7 -0
- data/test/fixtures/ruby/simple/lib/directives.rb +8 -0
- data/test/fixtures/{simple → ruby/simple}/lib/foo.rb +22 -1
- data/test/fixtures/{simple → ruby/simple}/lib/nodoc.rb +0 -0
- data/test/fixtures/{simple → ruby/simple}/lib/role_methods.rb +0 -0
- data/test/fixtures/{simple → ruby/simple}/lib/role_namespaces.rb +0 -0
- data/test/fixtures/{visibility → ruby/visibility}/lib/foo.rb +0 -0
- data/test/fixtures/{yardopts → ruby/yardopts}/.yardopts +0 -0
- data/test/fixtures/{yardopts → ruby/yardopts}/foo/bar.rb +0 -0
- data/test/integration/api/compare/codebases.rb +3 -3
- data/test/integration/cli/command/console_test.rb +6 -6
- data/test/integration/cli/command/diff_test.rb +62 -0
- data/test/integration/cli/command/inspect_test.rb +5 -6
- data/test/integration/cli/command/list_test.rb +4 -5
- data/test/integration/cli/command/show_test.rb +5 -5
- data/test/integration/cli/command/stats_test.rb +3 -3
- data/test/integration/cli/command/suggest_test.rb +13 -13
- data/test/integration/stats_options_test.rb +4 -4
- data/test/integration/visibility_options_test.rb +14 -14
- data/test/shared/base_list.rb +4 -3
- data/test/test_helper.rb +13 -13
- data/test/unit/api/filter_test.rb +7 -7
- data/test/unit/api/get_test.rb +1 -1
- data/test/unit/api/list_test.rb +1 -1
- data/test/unit/api/options/base_test.rb +3 -3
- data/test/unit/api/stats_test.rb +1 -1
- data/test/unit/api/suggest_test.rb +3 -3
- data/test/unit/cli/arguments_test.rb +2 -2
- data/test/unit/cli/command/base_test.rb +1 -1
- data/test/unit/cli/command/options/base_list_test.rb +2 -2
- data/test/unit/cli/command/options/base_object_test.rb +1 -1
- data/test/unit/cli/command/options/base_test.rb +1 -1
- data/test/unit/cli/command_parser_test.rb +3 -3
- data/test/unit/cli/trace_helper_test.rb +1 -1
- data/test/unit/cli/yardopts_helper_test.rb +6 -5
- data/test/unit/code_object/converter_test.rb +1 -1
- data/test/unit/code_object/provider_test.rb +2 -2
- data/test/unit/code_object/proxy_test.rb +2 -2
- data/test/unit/codebase/objects_test.rb +2 -2
- data/test/unit/codebase/proxy_test.rb +7 -5
- data/test/unit/config/codebase_test.rb +4 -4
- data/test/unit/config_test.rb +28 -0
- data/test/unit/evaluation/{role/base_test.rb → role_test.rb} +7 -7
- data/test/unit/{code_object/proxy → language/ruby/code_object}/method_object_test.rb +66 -21
- data/test/unit/{code_object → language/ruby}/provider/yard/docstring_test.rb +74 -38
- data/test/unit/{code_object → language/ruby}/provider/yard/nodoc_helper_test.rb +9 -7
- data/test/unit/{code_object → language/ruby}/provider/yard/object/method_object_test.rb +21 -11
- data/test/unit/language/ruby/provider/yard_test.rb +25 -0
- data/test/unit/utils/buffered_ui_test.rb +48 -0
- data/test/unit/utils/ui_test.rb +7 -7
- data/test/unit/utils/weighted_list_test.rb +7 -4
- metadata +139 -93
- data/lib/inch/code_object/provider/yard.rb +0 -57
- data/lib/inch/code_object/provider/yard/docstring.rb +0 -133
- data/lib/inch/code_object/provider/yard/nodoc_helper.rb +0 -93
- data/lib/inch/code_object/provider/yard/object.rb +0 -60
- data/lib/inch/code_object/provider/yard/object/base.rb +0 -302
- data/lib/inch/code_object/provider/yard/object/class_object.rb +0 -12
- data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +0 -12
- data/lib/inch/code_object/provider/yard/object/constant_object.rb +0 -12
- data/lib/inch/code_object/provider/yard/object/method_object.rb +0 -153
- data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +0 -88
- data/lib/inch/code_object/provider/yard/object/method_signature.rb +0 -114
- data/lib/inch/code_object/provider/yard/object/module_object.rb +0 -12
- data/lib/inch/code_object/provider/yard/object/namespace_object.rb +0 -47
- data/lib/inch/code_object/provider/yard/object/root_object.rb +0 -12
- data/lib/inch/code_object/provider/yard/parser.rb +0 -62
- data/lib/inch/code_object/proxy/base.rb +0 -241
- data/lib/inch/code_object/proxy/class_object.rb +0 -8
- data/lib/inch/code_object/proxy/class_variable_object.rb +0 -8
- data/lib/inch/code_object/proxy/constant_object.rb +0 -8
- data/lib/inch/code_object/proxy/method_object.rb +0 -82
- data/lib/inch/code_object/proxy/method_parameter_object.rb +0 -60
- data/lib/inch/code_object/proxy/module_object.rb +0 -8
- data/lib/inch/code_object/proxy/namespace_object.rb +0 -33
- data/lib/inch/evaluation/object_schema.rb +0 -30
- data/lib/inch/evaluation/proxy/base.rb +0 -164
- data/lib/inch/evaluation/proxy/class_object.rb +0 -8
- data/lib/inch/evaluation/proxy/class_variable_object.rb +0 -19
- data/lib/inch/evaluation/proxy/constant_object.rb +0 -19
- data/lib/inch/evaluation/proxy/method_object.rb +0 -65
- data/lib/inch/evaluation/proxy/module_object.rb +0 -8
- data/lib/inch/evaluation/proxy/namespace_object.rb +0 -27
- data/lib/inch/evaluation/role/base.rb +0 -92
- data/lib/inch/evaluation/role/class_variable.rb +0 -55
- data/lib/inch/evaluation/role/constant.rb +0 -55
- data/lib/inch/evaluation/role/method.rb +0 -126
- data/lib/inch/evaluation/role/method_parameter.rb +0 -91
- data/lib/inch/evaluation/role/missing.rb +0 -20
- data/lib/inch/evaluation/role/namespace.rb +0 -85
- data/lib/inch/evaluation/role/object.rb +0 -143
- data/test/unit/code_object/provider/yard_test.rb +0 -25
@@ -0,0 +1,24 @@
|
|
1
|
+
module Inch
|
2
|
+
module Language
|
3
|
+
module Ruby
|
4
|
+
module Evaluation
|
5
|
+
module Role
|
6
|
+
# Missing is the base class for things that can be improved in the doc
|
7
|
+
#
|
8
|
+
class Missing < Base
|
9
|
+
def score
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [Fixnum]
|
14
|
+
# a score that can be achieved by adding the missing thing mentioned
|
15
|
+
# by the role
|
16
|
+
def potential_score
|
17
|
+
@value.to_i
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Inch
|
2
|
+
module Language
|
3
|
+
module Ruby
|
4
|
+
module Evaluation
|
5
|
+
module Role
|
6
|
+
# Roles assigned to namespaces (classes and modules)
|
7
|
+
module Namespace
|
8
|
+
# Role assigned to namespaces with children
|
9
|
+
#
|
10
|
+
# @see CodeObject::Ruby::NamespaceObject#has_children?
|
11
|
+
class WithChildren < Base
|
12
|
+
applicable_if :has_children?
|
13
|
+
|
14
|
+
# This role doesnot assign a score.
|
15
|
+
def score
|
16
|
+
0
|
17
|
+
end
|
18
|
+
|
19
|
+
# This role sets a max_score.
|
20
|
+
def max_score
|
21
|
+
# @value.to_f
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Role assigned to namespaces with many children
|
26
|
+
#
|
27
|
+
# @see CodeObject::Ruby::NamespaceObject#has_many_children?
|
28
|
+
class WithManyChildren < Base
|
29
|
+
applicable_if :has_many_children?
|
30
|
+
|
31
|
+
# +priority
|
32
|
+
def priority
|
33
|
+
+1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Role assigned to namespaces with many attributes
|
38
|
+
#
|
39
|
+
# @see CodeObject::Ruby::NamespaceObject#has_many_attributes?
|
40
|
+
class WithManyAttributes < Base
|
41
|
+
applicable_if :has_many_attributes?
|
42
|
+
|
43
|
+
# +priority
|
44
|
+
def priority
|
45
|
+
+1
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Role assigned to namespaces without any children
|
50
|
+
class WithoutChildren < Base
|
51
|
+
applicable_unless :has_children?
|
52
|
+
end
|
53
|
+
|
54
|
+
# Role assigned to namespaces without any methods
|
55
|
+
class WithoutMethods < Base
|
56
|
+
applicable_unless :has_methods?
|
57
|
+
|
58
|
+
def priority
|
59
|
+
-2
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# A 'pure' namespace has only namespaces as children
|
64
|
+
class Pure < Base
|
65
|
+
applicable_if :pure_namespace?
|
66
|
+
|
67
|
+
def priority
|
68
|
+
-2
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# A 'core' namespace is a class or module that is part of the Ruby
|
73
|
+
# core. It might appear in the object tree when monkey-patching
|
74
|
+
# functionality.
|
75
|
+
# (the reasoning here is: just because we patch Hash does not mean
|
76
|
+
# we need to document the Hash class itself)
|
77
|
+
class Core < Base
|
78
|
+
applicable_if :core?
|
79
|
+
|
80
|
+
def priority
|
81
|
+
-7
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
module Inch
|
2
|
+
module Language
|
3
|
+
module Ruby
|
4
|
+
module Evaluation
|
5
|
+
module Role
|
6
|
+
# Roles assigned to all objects
|
7
|
+
module Object
|
8
|
+
# Role assigned to objects that are aliases.
|
9
|
+
#
|
10
|
+
class Alias < Base
|
11
|
+
applicable_if :alias?
|
12
|
+
# not sure about this yet,
|
13
|
+
# but aliases should not show up high in the reports
|
14
|
+
priority -7
|
15
|
+
end
|
16
|
+
|
17
|
+
# Role assigned to objects with a describing comment (docstring)
|
18
|
+
class WithDoc < Base
|
19
|
+
applicable_if :has_doc?
|
20
|
+
end
|
21
|
+
|
22
|
+
# Role assigned to objects without a docstring
|
23
|
+
class WithoutDoc < Missing
|
24
|
+
applicable_unless :has_doc?
|
25
|
+
|
26
|
+
def suggestion
|
27
|
+
"Add a comment describing the #{object_type}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Tagged means tagged in an unconsidred way, i.e. YARD tags not
|
32
|
+
# considered by Inch. Since these tags are parsed from the docstring
|
33
|
+
# the object seems undocumented to Inch.
|
34
|
+
class Tagged < Base
|
35
|
+
applicable_if :has_unconsidered_tags?
|
36
|
+
priority -1
|
37
|
+
end
|
38
|
+
|
39
|
+
# Role assigned to objects explicitly or implicitly tagged not to be
|
40
|
+
# documented.
|
41
|
+
#
|
42
|
+
# @see CodeObject::NodocHelper
|
43
|
+
class TaggedAsNodoc < Base
|
44
|
+
applicable_if :nodoc?
|
45
|
+
priority -7
|
46
|
+
end
|
47
|
+
|
48
|
+
# Role assigned to objects explicitly or implicitly tagged to be part
|
49
|
+
# of an API. If the API is 'private'/'internal' TaggedAsInternalAPI is
|
50
|
+
# assigned instead.
|
51
|
+
class TaggedAsAPI < Base
|
52
|
+
applicable_if :api_tag?
|
53
|
+
end
|
54
|
+
|
55
|
+
# Role assigned to objects explicitly or implicitly tagged to be part
|
56
|
+
# of a private API.
|
57
|
+
class TaggedAsInternalAPI < Base
|
58
|
+
applicable_if :tagged_as_internal_api?
|
59
|
+
priority -5
|
60
|
+
end
|
61
|
+
|
62
|
+
# Role assigned to objects explicitly or implicitly tagged to be
|
63
|
+
# private.
|
64
|
+
#
|
65
|
+
# @see CodeObject::NodocHelper
|
66
|
+
class TaggedAsPrivate < Base
|
67
|
+
applicable_if :tagged_as_private?
|
68
|
+
priority -5
|
69
|
+
end
|
70
|
+
|
71
|
+
# Role assigned to objects declared in the top-level namespace
|
72
|
+
class InRoot < Base
|
73
|
+
applicable_if :in_root?
|
74
|
+
priority +3
|
75
|
+
end
|
76
|
+
|
77
|
+
# Role assigned to public objects
|
78
|
+
class Public < Base
|
79
|
+
applicable_if :public?
|
80
|
+
priority +2
|
81
|
+
end
|
82
|
+
|
83
|
+
# Role assigned to protected objects
|
84
|
+
class Protected < Base
|
85
|
+
applicable_if :protected?
|
86
|
+
priority +1
|
87
|
+
end
|
88
|
+
|
89
|
+
# Role assigned to private objects
|
90
|
+
class Private < Base
|
91
|
+
applicable_if :private?
|
92
|
+
priority -2
|
93
|
+
end
|
94
|
+
|
95
|
+
# Role assigned to objects with a single code example
|
96
|
+
class WithCodeExample < Base
|
97
|
+
applicable_if do |o|
|
98
|
+
o.has_code_example? && !o.has_multiple_code_examples?
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Role assigned to objects with multiple code examples
|
103
|
+
class WithMultipleCodeExamples < Base
|
104
|
+
applicable_if :has_multiple_code_examples?
|
105
|
+
end
|
106
|
+
|
107
|
+
# Role assigned to objects without a code example
|
108
|
+
class WithoutCodeExample < Missing
|
109
|
+
applicable_unless :has_code_example?
|
110
|
+
|
111
|
+
def suggestion
|
112
|
+
"Add a code example (optional)"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
data/lib/inch/rake.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "inch"
|
2
|
+
require "inch/rake/suggest"
|
data/lib/inch/rake/suggest.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "rake"
|
4
|
+
require "rake/tasklib"
|
5
|
+
require "inch/cli"
|
5
6
|
|
6
7
|
module Inch
|
7
8
|
# Holds all Rake tasks
|
8
9
|
module Rake
|
10
|
+
# Provides Rake task integration
|
9
11
|
class Suggest < ::Rake::TaskLib
|
12
|
+
# @return [String] name of the Rake task
|
10
13
|
attr_accessor :name
|
14
|
+
# @return [Array] arguments to be passed to Suggest.run
|
11
15
|
attr_accessor :args
|
12
16
|
|
13
17
|
# @param name [String] name of the Rake task
|
@@ -22,6 +26,7 @@ module Inch
|
|
22
26
|
task(@name) { suggest }
|
23
27
|
end
|
24
28
|
|
29
|
+
# @return [void]
|
25
30
|
def suggest
|
26
31
|
::Inch::CLI::Command::Suggest.run(*@args)
|
27
32
|
end
|
data/lib/inch/utils/ui.rb
CHANGED
@@ -10,9 +10,9 @@ module Inch
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def debug(msg)
|
13
|
-
return unless ENV[
|
13
|
+
return unless ENV["DEBUG"]
|
14
14
|
msg.to_s.lines.each do |line|
|
15
|
-
trace edged :dark, line.gsub(/\n$/,
|
15
|
+
trace edged :dark, line.gsub(/\n$/, "").dark
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -45,12 +45,12 @@ module Inch
|
|
45
45
|
def header(text, color, bg_color = nil)
|
46
46
|
@current_header_color = color
|
47
47
|
trace __header(text, color, bg_color)
|
48
|
-
trace
|
48
|
+
trace unless use_color?
|
49
49
|
end
|
50
50
|
|
51
51
|
# @return [Boolean] true if the UI uses coloring
|
52
52
|
def use_color?
|
53
|
-
Term::ANSIColor
|
53
|
+
Term::ANSIColor.coloring?
|
54
54
|
end
|
55
55
|
|
56
56
|
private
|
@@ -61,7 +61,7 @@ module Inch
|
|
61
61
|
|
62
62
|
def __header(text, color, bg_color = nil)
|
63
63
|
bg_color ||= "intense_#{color}"
|
64
|
-
bar = " #{text}".ljust(CLI::COLUMNS-1)
|
64
|
+
bar = " #{text}".ljust(CLI::COLUMNS - 1)
|
65
65
|
.on_color(bg_color).color(:color16)
|
66
66
|
"#".color(color).on_color(color) + bar
|
67
67
|
end
|
@@ -74,9 +74,8 @@ module Inch
|
|
74
74
|
target_count = @max_counts[index]
|
75
75
|
@list[index].concat sublist[0...target_count]
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
end
|
77
|
+
next unless sublist.size < target_count
|
78
|
+
missing += target_count - sublist.size
|
80
79
|
end
|
81
80
|
missing
|
82
81
|
end
|
data/lib/inch/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -18,13 +18,6 @@ module Foo
|
|
18
18
|
def method_with_empty_param_tag_text(e)
|
19
19
|
end
|
20
20
|
|
21
|
-
# The problem here is that ...
|
22
|
-
#
|
23
|
-
# @param *names [Array]
|
24
|
-
# @return [String]
|
25
|
-
def method_with_splat_parameter(*names)
|
26
|
-
end
|
27
|
-
|
28
21
|
# The problem here is that ...
|
29
22
|
#
|
30
23
|
# @param names [Array]
|
@@ -38,20 +31,19 @@ module Foo
|
|
38
31
|
def method_with_wrong_return_tag
|
39
32
|
end
|
40
33
|
|
41
|
-
#
|
42
|
-
#
|
43
|
-
# @param
|
44
|
-
|
34
|
+
# The problem here is that ...
|
35
|
+
#
|
36
|
+
# @param *names [Array]
|
37
|
+
# @return [String]
|
38
|
+
def method_with_splat_parameter(*names)
|
45
39
|
end
|
46
|
-
end
|
47
40
|
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
|
53
|
-
|
54
|
-
attr_accessor :username
|
41
|
+
# Initializes a new Connection instance
|
42
|
+
# @param [Hash<Symbol, >] params One or more optional params
|
43
|
+
# @option params [String] :body Default text to be sent over a socket. Only used if :body absent in Connection#request params
|
44
|
+
# @option params [Hash<Symbol, String>] :headers The default headers to supply in a request. Only used if params[:headers] is not supplied to Connection#request
|
45
|
+
def method_with_indented_param_tag(params = {})
|
46
|
+
end
|
55
47
|
end
|
56
48
|
|
57
49
|
module Overloading
|
@@ -41,10 +41,14 @@ module Foo
|
|
41
41
|
def method_without_docstring(p1, p2 = nil)
|
42
42
|
end
|
43
43
|
|
44
|
-
# @return [
|
44
|
+
# @return [String]
|
45
45
|
def method_without_params_or_docstring
|
46
46
|
end
|
47
47
|
|
48
|
+
# @return [void]
|
49
|
+
def method_without_usable_return_value
|
50
|
+
end
|
51
|
+
|
48
52
|
# Provides an example of a method without parameters
|
49
53
|
# missing the return type.
|
50
54
|
#
|
@@ -72,6 +76,23 @@ module Foo
|
|
72
76
|
def method_with_other_rdoc_doc(param1, param2, param3)
|
73
77
|
end
|
74
78
|
|
79
|
+
# Injects text right after the class definition. Since it depends on
|
80
|
+
# insert_into_file, it's reversible.
|
81
|
+
#
|
82
|
+
# ==== Parameters
|
83
|
+
# param1<String>:: path of the file to be changed
|
84
|
+
# param2<String|Class>:: the class to be manipulated
|
85
|
+
#
|
86
|
+
# ==== Examples
|
87
|
+
#
|
88
|
+
# inject_into_class "app/controllers/application_controller.rb", ApplicationController, " filter_parameter :password\n"
|
89
|
+
#
|
90
|
+
# inject_into_class "app/controllers/application_controller.rb", ApplicationController do
|
91
|
+
# " filter_parameter :password\n"
|
92
|
+
# end
|
93
|
+
def method_with_yet_another_rdoc_doc(param1, param2)
|
94
|
+
end
|
95
|
+
|
75
96
|
# An example of a method that takes a parameter (+param1+)
|
76
97
|
# and does nothing. But the previous sentence mentions said
|
77
98
|
# parameter.
|