inch 0.4.10 → 0.5.0.rc1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -11
- data/Gemfile +2 -5
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/bin/inch +3 -3
- data/config/defaults.rb +0 -7
- data/inch.gemspec +7 -7
- data/lib/inch.rb +9 -9
- data/lib/inch/api.rb +10 -10
- data/lib/inch/api/compare.rb +2 -2
- data/lib/inch/api/compare/code_objects.rb +3 -2
- data/lib/inch/api/compare/codebases.rb +1 -1
- data/lib/inch/api/diff.rb +10 -7
- data/lib/inch/api/filter.rb +1 -1
- data/lib/inch/api/get.rb +1 -1
- data/lib/inch/api/options/base.rb +4 -4
- data/lib/inch/api/options/filter.rb +4 -0
- data/lib/inch/api/options/suggest.rb +5 -1
- data/lib/inch/api/stats.rb +1 -0
- data/lib/inch/api/suggest.rb +10 -9
- 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 +4 -4
- data/lib/inch/cli/command/console.rb +5 -5
- data/lib/inch/cli/command/diff.rb +8 -7
- data/lib/inch/cli/command/inspect.rb +4 -5
- data/lib/inch/cli/command/list.rb +4 -4
- data/lib/inch/cli/command/options/base.rb +8 -8
- data/lib/inch/cli/command/options/base_list.rb +5 -9
- data/lib/inch/cli/command/options/console.rb +3 -4
- data/lib/inch/cli/command/options/diff.rb +6 -8
- data/lib/inch/cli/command/options/inspect.rb +2 -2
- data/lib/inch/cli/command/options/list.rb +2 -3
- data/lib/inch/cli/command/options/show.rb +2 -2
- data/lib/inch/cli/command/options/stats.rb +1 -2
- data/lib/inch/cli/command/options/suggest.rb +3 -6
- data/lib/inch/cli/command/output/base.rb +6 -4
- data/lib/inch/cli/command/output/console.rb +5 -4
- data/lib/inch/cli/command/output/diff.rb +6 -6
- data/lib/inch/cli/command/output/inspect.rb +8 -6
- data/lib/inch/cli/command/output/list.rb +1 -0
- data/lib/inch/cli/command/output/show.rb +5 -4
- data/lib/inch/cli/command/output/stats.rb +21 -21
- data/lib/inch/cli/command/output/suggest.rb +27 -30
- 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 +5 -6
- 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 +3 -4
- data/lib/inch/code_object.rb +3 -3
- data/lib/inch/code_object/converter.rb +8 -6
- data/lib/inch/code_object/provider.rb +1 -1
- data/lib/inch/code_object/provider/yard.rb +12 -10
- data/lib/inch/code_object/provider/yard/docstring.rb +19 -51
- data/lib/inch/code_object/provider/yard/nodoc_helper.rb +4 -4
- data/lib/inch/code_object/provider/yard/object.rb +10 -12
- data/lib/inch/code_object/provider/yard/object/base.rb +27 -48
- data/lib/inch/code_object/provider/yard/object/method_object.rb +10 -47
- data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +6 -10
- data/lib/inch/code_object/provider/yard/object/method_signature.rb +8 -12
- data/lib/inch/code_object/provider/yard/object/namespace_object.rb +4 -1
- data/lib/inch/code_object/provider/yard/parser.rb +3 -3
- data/lib/inch/code_object/proxy.rb +9 -10
- data/lib/inch/code_object/proxy/base.rb +10 -12
- data/lib/inch/code_object/proxy/method_object.rb +2 -3
- data/lib/inch/code_object/proxy/method_parameter_object.rb +3 -5
- data/lib/inch/codebase.rb +5 -4
- data/lib/inch/codebase/objects_filter.rb +4 -2
- data/lib/inch/codebase/serializer.rb +3 -3
- data/lib/inch/config.rb +2 -2
- data/lib/inch/config/base.rb +1 -0
- data/lib/inch/config/codebase.rb +4 -4
- data/lib/inch/core_ext.rb +1 -1
- data/lib/inch/core_ext/string.rb +1 -1
- data/lib/inch/evaluation.rb +15 -16
- data/lib/inch/evaluation/file.rb +1 -1
- data/lib/inch/evaluation/grade_list.rb +2 -2
- data/lib/inch/evaluation/object_schema.rb +1 -1
- data/lib/inch/evaluation/proxy.rb +7 -8
- data/lib/inch/evaluation/proxy/base.rb +10 -13
- data/lib/inch/evaluation/proxy/constant_object.rb +1 -1
- data/lib/inch/evaluation/proxy/method_object.rb +5 -12
- data/lib/inch/evaluation/proxy/module_object.rb +1 -1
- data/lib/inch/evaluation/proxy/namespace_object.rb +1 -1
- data/lib/inch/evaluation/role/base.rb +1 -1
- data/lib/inch/evaluation/role/method.rb +2 -2
- data/lib/inch/evaluation/role/method_parameter.rb +1 -2
- data/lib/inch/evaluation/role/object.rb +2 -2
- data/lib/inch/rake.rb +2 -2
- data/lib/inch/rake/suggest.rb +2 -3
- data/lib/inch/utils/shell_helper.rb +1 -1
- data/lib/inch/utils/ui.rb +5 -5
- data/lib/inch/utils/weighted_list.rb +3 -2
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/simple/lib/broken.rb +7 -35
- data/test/fixtures/simple/lib/foo.rb +1 -22
- data/test/integration/api/compare/codebases.rb +1 -1
- data/test/integration/cli/command/console_test.rb +5 -5
- data/test/integration/cli/command/inspect_test.rb +5 -4
- data/test/integration/cli/command/list_test.rb +4 -3
- data/test/integration/cli/command/show_test.rb +4 -4
- data/test/integration/cli/command/stats_test.rb +2 -2
- data/test/integration/cli/command/suggest_test.rb +10 -10
- data/test/integration/stats_options_test.rb +3 -3
- data/test/integration/visibility_options_test.rb +13 -13
- data/test/shared/base_list.rb +3 -4
- data/test/test_helper.rb +6 -16
- 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 +1 -1
- 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 +2 -2
- data/test/unit/cli/trace_helper_test.rb +1 -1
- data/test/unit/cli/yardopts_helper_test.rb +3 -4
- data/test/unit/code_object/converter_test.rb +1 -1
- data/test/unit/code_object/provider/yard/docstring_test.rb +28 -106
- data/test/unit/code_object/provider/yard/nodoc_helper_test.rb +5 -6
- data/test/unit/code_object/provider/yard/object/method_object_test.rb +10 -20
- data/test/unit/code_object/provider/yard_test.rb +4 -4
- data/test/unit/code_object/provider_test.rb +1 -1
- data/test/unit/code_object/proxy/method_object_test.rb +262 -382
- data/test/unit/code_object/proxy_test.rb +1 -1
- data/test/unit/codebase/objects_test.rb +2 -2
- data/test/unit/codebase/proxy_test.rb +1 -1
- data/test/unit/config/codebase_test.rb +1 -1
- data/test/unit/evaluation/role/base_test.rb +2 -2
- data/test/unit/utils/ui_test.rb +4 -4
- data/test/unit/utils/weighted_list_test.rb +4 -7
- metadata +4 -14
- data/.rubocop.yml +0 -15
- data/.rubocop_todo.yml +0 -94
- data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +0 -12
- data/lib/inch/code_object/proxy/class_variable_object.rb +0 -8
- data/lib/inch/evaluation/proxy/class_variable_object.rb +0 -19
- data/lib/inch/evaluation/role/class_variable.rb +0 -55
- data/test/fixtures/simple/lib/broken_ruby_2_0_features.rb +0 -7
- data/test/fixtures/simple/lib/directives.rb +0 -8
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'inch/code_object/provider/yard/object/method_signature'
|
2
2
|
|
3
3
|
module Inch
|
4
4
|
module CodeObject
|
@@ -46,7 +46,7 @@ module Inch
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def parameter(name)
|
49
|
-
parameters.
|
49
|
+
parameters.detect { |p| p.name == name.to_s }
|
50
50
|
end
|
51
51
|
|
52
52
|
def overridden?
|
@@ -66,14 +66,13 @@ module Inch
|
|
66
66
|
# Returns +true+ if a return value is described by it's type or
|
67
67
|
# mentioned in the docstring (e.g. "Returns a String").
|
68
68
|
def return_mentioned?
|
69
|
-
return_tags.any?
|
70
|
-
|
71
|
-
end || docstring.mentions_return? && !implicit_docstring?
|
69
|
+
return_tags.any? { |t| !t.types.nil? && !t.types.empty? && !YARD.implicit_tag?(t, self) } ||
|
70
|
+
docstring.mentions_return? && !implicit_docstring?
|
72
71
|
end
|
73
72
|
|
74
73
|
# Returns +true+ if a return value is described by words.
|
75
74
|
def return_described?
|
76
|
-
|
75
|
+
return_tags.any? { |t| !t.text.empty? && !YARD.implicit_tag?(t, self) } ||
|
77
76
|
docstring.describes_return? && !implicit_docstring?
|
78
77
|
end
|
79
78
|
|
@@ -103,60 +102,24 @@ module Inch
|
|
103
102
|
|
104
103
|
private
|
105
104
|
|
106
|
-
# Returns
|
107
|
-
# corresponding to this setter.
|
108
|
-
#
|
109
|
-
# @return [Array<::YARD::Tag>]
|
110
|
-
def attributed_return_tags
|
111
|
-
if setter? && object.tags(:return).empty?
|
112
|
-
method = corresponding_getter
|
113
|
-
return method.object.tags(:return) if method
|
114
|
-
end
|
115
|
-
[]
|
116
|
-
end
|
117
|
-
|
118
|
-
# @return [MethodObject,nil]
|
119
|
-
def corresponding_getter
|
120
|
-
clean_name = name.to_s.gsub(/(\=)$/, "")
|
121
|
-
parent.child(clean_name.to_sym)
|
122
|
-
end
|
123
|
-
|
124
|
-
# Returns +true+ if the docstring was generated by YARD.
|
105
|
+
# Returns +true+ if the docstring was generated by YARD
|
125
106
|
def implicit_docstring?
|
126
107
|
YARD.implicit_docstring?(docstring, self)
|
127
108
|
end
|
128
109
|
|
129
|
-
# @return [Array<::YARD::Tag>]
|
130
110
|
def overload_tags
|
131
111
|
object.tags(:overload)
|
132
112
|
end
|
133
113
|
|
134
|
-
|
114
|
+
def return_tags
|
115
|
+
object.tags(:return) + overloaded_return_tags
|
116
|
+
end
|
117
|
+
|
135
118
|
def overloaded_return_tags
|
136
119
|
overload_tags.map do |overload_tag|
|
137
120
|
overload_tag.tag(:return)
|
138
121
|
end.compact
|
139
122
|
end
|
140
|
-
|
141
|
-
# @return [Array<::YARD::Tag>]
|
142
|
-
def return_tags
|
143
|
-
object.tags(:return) +
|
144
|
-
overloaded_return_tags +
|
145
|
-
attributed_return_tags
|
146
|
-
end
|
147
|
-
|
148
|
-
# Returns +true+ if a return value is described by words.
|
149
|
-
def return_described_via_tag?
|
150
|
-
return_tags.any? do |t|
|
151
|
-
return_tag_describes_unusable_value?(t) ||
|
152
|
-
!t.text.empty? && !YARD.implicit_tag?(t, self)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def return_tag_describes_unusable_value?(t)
|
157
|
-
return if t.types.nil?
|
158
|
-
t.types.size == 1 && %w(void nil nothing).include?(t.types.first)
|
159
|
-
end
|
160
123
|
end
|
161
124
|
end
|
162
125
|
end
|
@@ -7,11 +7,9 @@ module Inch
|
|
7
7
|
class MethodParameterObject
|
8
8
|
attr_reader :name # @return [String]
|
9
9
|
|
10
|
-
# @param method [YARD::Object::MethodObject] the method the
|
11
|
-
# parameter belongs to
|
10
|
+
# @param method [YARD::Object::MethodObject] the method the parameter belongs to
|
12
11
|
# @param name [String] the name of the parameter
|
13
|
-
# @param in_signature [String] how the parameter is noted in the
|
14
|
-
# method's signature
|
12
|
+
# @param in_signature [String] how the parameter is noted in the method's signature
|
15
13
|
# @param tag [YARD::Tags::Tag] the Tag object for the parameter
|
16
14
|
def initialize(method, name, in_signature, tag)
|
17
15
|
@method = method
|
@@ -23,8 +21,7 @@ module Inch
|
|
23
21
|
BAD_NAME_EXCEPTIONS = %w(id)
|
24
22
|
BAD_NAME_THRESHOLD = 3
|
25
23
|
|
26
|
-
# @return [Boolean] +true+ if the name of the parameter is
|
27
|
-
# uncommunicative
|
24
|
+
# @return [Boolean] +true+ if the name of the parameter is uncommunicative
|
28
25
|
def bad_name?
|
29
26
|
return false if BAD_NAME_EXCEPTIONS.include?(name)
|
30
27
|
name.size < BAD_NAME_THRESHOLD || name =~ /[0-9]$/
|
@@ -55,8 +52,7 @@ module Inch
|
|
55
52
|
@tag && @tag.types && !@tag.types.empty?
|
56
53
|
end
|
57
54
|
|
58
|
-
# @return [Boolean] +true+ if the parameter is mentioned in the
|
59
|
-
# docs, but not present in the method's signature
|
55
|
+
# @return [Boolean] +true+ if the parameter is mentioned in the docs, but not present in the method's signature
|
60
56
|
def wrongly_mentioned?
|
61
57
|
mentioned? && !@in_signature
|
62
58
|
end
|
@@ -71,7 +67,7 @@ module Inch
|
|
71
67
|
if @method.docstring.describes_parameter?(name)
|
72
68
|
true
|
73
69
|
else
|
74
|
-
unsplatted = name.gsub(/^[\&\*]/,
|
70
|
+
unsplatted = name.gsub(/^[\&\*]/, '')
|
75
71
|
@method.docstring.describes_parameter?(unsplatted)
|
76
72
|
end
|
77
73
|
end
|
@@ -80,7 +76,7 @@ module Inch
|
|
80
76
|
if @method.docstring.mentions_parameter?(name)
|
81
77
|
true
|
82
78
|
else
|
83
|
-
unsplatted = name.gsub(/^[\&\*]/,
|
79
|
+
unsplatted = name.gsub(/^[\&\*]/, '')
|
84
80
|
@method.docstring.mentions_parameter?(unsplatted)
|
85
81
|
end
|
86
82
|
end
|
@@ -8,13 +8,11 @@ module Inch
|
|
8
8
|
attr_reader :method, :docstring
|
9
9
|
|
10
10
|
# @param method [Provider::YARD::Object::MethodObject]
|
11
|
-
# @param
|
12
|
-
# normal signature is used
|
11
|
+
# @param method [::YARD::Tags::Tag,nil] if nil, the method's normal signature is used
|
13
12
|
def initialize(method, yard_tag = nil)
|
14
13
|
@method = method
|
15
14
|
@yard_tag = yard_tag
|
16
|
-
@docstring =
|
17
|
-
Provider::YARD::Docstring.new(relevant_object.docstring)
|
15
|
+
@docstring = Provider::YARD::Docstring.new(relevant_object.docstring)
|
18
16
|
end
|
19
17
|
|
20
18
|
def all_signature_parameter_names
|
@@ -45,28 +43,26 @@ module Inch
|
|
45
43
|
# @param name [String,Symbol]
|
46
44
|
# @return [MethodParameterObject]
|
47
45
|
def parameter(name)
|
48
|
-
parameters.
|
46
|
+
parameters.detect { |p| p.name == name.to_s }
|
49
47
|
end
|
50
48
|
|
51
49
|
# Returns +true+ if the other signature is identical to self
|
52
50
|
# @param other [MethodSignature]
|
53
51
|
# @return [Boolean]
|
54
52
|
def same?(other)
|
55
|
-
all_signature_parameter_names ==
|
56
|
-
other.all_signature_parameter_names
|
53
|
+
all_signature_parameter_names == other.all_signature_parameter_names
|
57
54
|
end
|
58
55
|
|
59
56
|
# Returns the actual signature of the method.
|
60
57
|
# @return [String]
|
61
58
|
def signature
|
62
|
-
relevant_object.signature.gsub(/^(def\ )/,
|
59
|
+
relevant_object.signature.gsub(/^(def\ )/, '')
|
63
60
|
end
|
64
61
|
|
65
62
|
private
|
66
63
|
|
67
64
|
def all_parameter_names
|
68
|
-
all_names = all_signature_parameter_names +
|
69
|
-
parameter_tags.map(&:name)
|
65
|
+
all_names = all_signature_parameter_names + parameter_tags.map(&:name)
|
70
66
|
all_names.map do |name|
|
71
67
|
normalize_parameter_name(name) if name
|
72
68
|
end.compact.uniq
|
@@ -94,11 +90,11 @@ module Inch
|
|
94
90
|
# @param name [String] parameter name
|
95
91
|
# @return [String]
|
96
92
|
def normalize_parameter_name(name)
|
97
|
-
name.gsub(/[\&\*\$\[\]]/,
|
93
|
+
name.gsub(/[\&\*\$\[\]]/, '')
|
98
94
|
end
|
99
95
|
|
100
96
|
def parameter_tag(param_name)
|
101
|
-
parameter_tags.
|
97
|
+
parameter_tags.detect do |tag|
|
102
98
|
tag.name == param_name
|
103
99
|
end
|
104
100
|
end
|
@@ -28,7 +28,9 @@ module Inch
|
|
28
28
|
|
29
29
|
# called by MethodObject#getter?
|
30
30
|
def child(name)
|
31
|
-
|
31
|
+
if children
|
32
|
+
children.detect { |child| child.name == name }
|
33
|
+
end
|
32
34
|
end
|
33
35
|
|
34
36
|
def children
|
@@ -36,6 +38,7 @@ module Inch
|
|
36
38
|
YARD::Object.for(o)
|
37
39
|
end
|
38
40
|
end
|
41
|
+
|
39
42
|
end
|
40
43
|
end
|
41
44
|
end
|
@@ -11,7 +11,7 @@ module Inch
|
|
11
11
|
# @see #parse
|
12
12
|
# @return [CodeObject::Provider::YARD::Parser] the instance that ran
|
13
13
|
def self.parse(*args)
|
14
|
-
parser = new
|
14
|
+
parser = self.new
|
15
15
|
parser.parse(*args)
|
16
16
|
parser
|
17
17
|
end
|
@@ -46,8 +46,8 @@ module Inch
|
|
46
46
|
object.base_dir = dir
|
47
47
|
|
48
48
|
object.aliases_fullnames.each do |fullname|
|
49
|
-
|
50
|
-
|
49
|
+
_alias = objects.detect { |o| o.fullname == fullname }
|
50
|
+
_alias.aliased_object_fullname = object.fullname
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -11,7 +11,7 @@ module Inch
|
|
11
11
|
# @return [CodeObject::Proxy::Base]
|
12
12
|
def for(code_object)
|
13
13
|
attributes = Converter.to_hash(code_object)
|
14
|
-
class_for(code_object).new(attributes)
|
14
|
+
proxy_object = class_for(code_object).new(attributes)
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -21,7 +21,7 @@ module Inch
|
|
21
21
|
# @param code_object [YARD::CodeObject]
|
22
22
|
# @return [Class]
|
23
23
|
def class_for(code_object)
|
24
|
-
class_name = code_object.class.to_s.split(
|
24
|
+
class_name = code_object.class.to_s.split('::').last
|
25
25
|
const_get(class_name)
|
26
26
|
end
|
27
27
|
end
|
@@ -29,11 +29,10 @@ module Inch
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
require
|
33
|
-
require
|
34
|
-
require
|
35
|
-
require
|
36
|
-
require
|
37
|
-
require
|
38
|
-
require
|
39
|
-
require "inch/code_object/proxy/module_object"
|
32
|
+
require 'inch/code_object/proxy/base'
|
33
|
+
require 'inch/code_object/proxy/namespace_object'
|
34
|
+
require 'inch/code_object/proxy/class_object'
|
35
|
+
require 'inch/code_object/proxy/constant_object'
|
36
|
+
require 'inch/code_object/proxy/method_object'
|
37
|
+
require 'inch/code_object/proxy/method_parameter_object'
|
38
|
+
require 'inch/code_object/proxy/module_object'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'forwardable'
|
2
2
|
|
3
3
|
module Inch
|
4
4
|
module CodeObject
|
@@ -42,9 +42,9 @@ module Inch
|
|
42
42
|
|
43
43
|
# @return [Symbol]
|
44
44
|
def grade
|
45
|
-
@grade ||= Evaluation.new_grade_lists.
|
46
|
-
|
47
|
-
|
45
|
+
@grade ||= Evaluation.new_grade_lists.detect { |range|
|
46
|
+
range.scores.include?(score)
|
47
|
+
}.grade
|
48
48
|
end
|
49
49
|
|
50
50
|
# @return [Boolean] if the current object is an alias for something else
|
@@ -52,10 +52,9 @@ module Inch
|
|
52
52
|
!aliased_object.nil?
|
53
53
|
end
|
54
54
|
|
55
|
-
# @return [CodeObject::Proxy::Base] the object the current object is an
|
56
|
-
# alias of
|
55
|
+
# @return [CodeObject::Proxy::Base] the object the current object is an alias of
|
57
56
|
def aliased_object
|
58
|
-
object_lookup.find(self[:aliased_object_fullname])
|
57
|
+
object_lookup.find( self[:aliased_object_fullname] )
|
59
58
|
end
|
60
59
|
|
61
60
|
# @return [Boolean] +true+ if the object has an @api tag
|
@@ -171,10 +170,9 @@ module Inch
|
|
171
170
|
self[:nodoc?]
|
172
171
|
end
|
173
172
|
|
174
|
-
# @return [CodeObject::Proxy::Base,nil] the parent of the current object
|
175
|
-
# or +nil+
|
173
|
+
# @return [CodeObject::Proxy::Base,nil] the parent of the current object or +nil+
|
176
174
|
def parent
|
177
|
-
object_lookup.find(self[:parent_fullname])
|
175
|
+
object_lookup.find( self[:parent_fullname] )
|
178
176
|
end
|
179
177
|
|
180
178
|
def private?
|
@@ -207,7 +205,7 @@ module Inch
|
|
207
205
|
end
|
208
206
|
|
209
207
|
def type
|
210
|
-
self.class.to_s.gsub(/Object$/,
|
208
|
+
self.class.to_s.gsub(/Object$/, '')
|
211
209
|
end
|
212
210
|
|
213
211
|
# @return [Boolean] +true+ if the object has no documentation at all
|
@@ -235,7 +233,7 @@ module Inch
|
|
235
233
|
end
|
236
234
|
|
237
235
|
def inspect
|
238
|
-
"#<#{self.class}: #{fullname}>"
|
236
|
+
"#<#{self.class.to_s}: #{fullname}>"
|
239
237
|
end
|
240
238
|
end
|
241
239
|
end
|
@@ -36,7 +36,7 @@ module Inch
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def parameter(name)
|
39
|
-
parameters.
|
39
|
+
parameters.detect { |p| p.name == name.to_s }
|
40
40
|
end
|
41
41
|
|
42
42
|
def parameters
|
@@ -50,8 +50,7 @@ module Inch
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def overridden_method
|
53
|
-
@overridden_method ||=
|
54
|
-
object_lookup.find(self[:overridden_method_fullname])
|
53
|
+
@overridden_method ||= object_lookup.find(self[:overridden_method_fullname])
|
55
54
|
end
|
56
55
|
|
57
56
|
def return_mentioned?
|
@@ -14,8 +14,7 @@ module Inch
|
|
14
14
|
BAD_NAME_EXCEPTIONS = %w(id)
|
15
15
|
BAD_NAME_THRESHOLD = 3
|
16
16
|
|
17
|
-
# @return [Boolean] +true+ if the name of the parameter is
|
18
|
-
# uncommunicative
|
17
|
+
# @return [Boolean] +true+ if the name of the parameter is uncommunicative
|
19
18
|
def bad_name?
|
20
19
|
return false if BAD_NAME_EXCEPTIONS.include?(name)
|
21
20
|
name.size < BAD_NAME_THRESHOLD || name =~ /[0-9]$/
|
@@ -39,7 +38,7 @@ module Inch
|
|
39
38
|
def name
|
40
39
|
self[:name]
|
41
40
|
end
|
42
|
-
|
41
|
+
alias fullname name
|
43
42
|
|
44
43
|
# @return [Boolean] +true+ if the parameter is a splat argument
|
45
44
|
def splat?
|
@@ -51,8 +50,7 @@ module Inch
|
|
51
50
|
self[:typed?]
|
52
51
|
end
|
53
52
|
|
54
|
-
# @return [Boolean] +true+ if the parameter is mentioned in the docs,
|
55
|
-
# but not present in the method's signature
|
53
|
+
# @return [Boolean] +true+ if the parameter is mentioned in the docs, but not present in the method's signature
|
56
54
|
def wrongly_mentioned?
|
57
55
|
self[:wrongly_mentioned?]
|
58
56
|
end
|
data/lib/inch/codebase.rb
CHANGED
@@ -15,7 +15,8 @@ module Inch
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
18
|
+
require 'inch/codebase/proxy'
|
19
|
+
require 'inch/codebase/objects'
|
20
|
+
require 'inch/codebase/objects_filter'
|
21
|
+
require 'inch/codebase/serializer'
|
22
|
+
|
@@ -41,14 +41,16 @@ module Inch
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def filter_depth
|
44
|
-
|
44
|
+
if options.depth
|
45
|
+
@list = @list.select { |o| o.depth <= options.depth }
|
46
|
+
end
|
45
47
|
end
|
46
48
|
|
47
49
|
def filter_visibility
|
48
50
|
@list = @list.select do |o|
|
49
51
|
options.visibility.include?(o.visibility)
|
50
52
|
end
|
51
|
-
|
53
|
+
if !options.visibility.include?(:private)
|
52
54
|
@list = @list.reject do |o|
|
53
55
|
o.tagged_as_private?
|
54
56
|
end
|
@@ -9,12 +9,12 @@ module Inch
|
|
9
9
|
|
10
10
|
def self.save(codebase, filename)
|
11
11
|
content = Marshal.dump(codebase)
|
12
|
-
FileUtils.mkdir_p(File.dirname(filename))
|
13
|
-
File.open(filename,
|
12
|
+
FileUtils.mkdir_p( File.dirname(filename) )
|
13
|
+
File.open(filename, 'wb') { |file| file.write(content) }
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.load(filename)
|
17
|
-
codebase = Marshal.load(File.binread(filename))
|
17
|
+
codebase = Marshal.load( File.binread(filename) )
|
18
18
|
codebase.objects.each do |object|
|
19
19
|
object.object_lookup = codebase.objects
|
20
20
|
end
|
data/lib/inch/config.rb
CHANGED