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,27 @@
|
|
1
|
+
module Inch
|
2
|
+
module Language
|
3
|
+
module Elixir
|
4
|
+
module Evaluation
|
5
|
+
# Proxy class for modules
|
6
|
+
class ModuleObject < Base
|
7
|
+
protected
|
8
|
+
|
9
|
+
def relevant_roles
|
10
|
+
relevant_base_roles.merge(relevant_namespace_roles)
|
11
|
+
end
|
12
|
+
|
13
|
+
# @see Evaluation::Ruby::Base
|
14
|
+
def relevant_namespace_roles
|
15
|
+
{
|
16
|
+
Role::Module::WithoutChildren => nil,
|
17
|
+
Role::Module::WithChildren => nil,
|
18
|
+
Role::Module::WithManyChildren => nil,
|
19
|
+
Role::Module::WithoutMethods => nil,
|
20
|
+
Role::Module::Pure => nil
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Inch
|
2
|
+
module Language
|
3
|
+
module Elixir
|
4
|
+
end
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
require "inch/language/elixir/provider/reader"
|
9
|
+
|
10
|
+
require "inch/language/elixir/code_object/base"
|
11
|
+
require "inch/language/elixir/code_object/module_object"
|
12
|
+
require "inch/language/elixir/code_object/function_object"
|
13
|
+
require "inch/language/elixir/code_object/type_object"
|
14
|
+
|
15
|
+
require "inch/language/elixir/evaluation/base"
|
16
|
+
require "inch/language/elixir/evaluation/module_object"
|
17
|
+
require "inch/language/elixir/evaluation/function_object"
|
18
|
+
require "inch/language/elixir/evaluation/type_object"
|
19
|
+
|
20
|
+
require "inch/language/elixir/roles/base"
|
21
|
+
require "inch/language/elixir/roles/object"
|
22
|
+
require "inch/language/elixir/roles/module"
|
23
|
+
require "inch/language/elixir/roles/function"
|
24
|
+
require "inch/language/elixir/roles/type"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Inch
|
4
|
+
module Language
|
5
|
+
module Elixir
|
6
|
+
module Provider
|
7
|
+
# Parses the source tree (using Reader)
|
8
|
+
module Reader
|
9
|
+
# @see Provider.parse
|
10
|
+
def self.parse(dir, config)
|
11
|
+
Parser.parse(dir, config)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require "inch/language/elixir/provider/reader/parser"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require "inch/language/elixir/provider/reader/object/base"
|
2
|
+
require "inch/language/elixir/provider/reader/object/function_object"
|
3
|
+
require "inch/language/elixir/provider/reader/object/module_object"
|
4
|
+
require "inch/language/elixir/provider/reader/object/type_object"
|
5
|
+
|
6
|
+
module Inch
|
7
|
+
module Language
|
8
|
+
module Elixir
|
9
|
+
module Provider
|
10
|
+
module Reader
|
11
|
+
# CodeObject::Provider::JSDoc::Object object represent code objects.
|
12
|
+
#
|
13
|
+
module Object
|
14
|
+
class << self
|
15
|
+
def clear_cache
|
16
|
+
@cache = {}
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns a Proxy object for the given +json_object+
|
20
|
+
#
|
21
|
+
# @param json_object [Hash]
|
22
|
+
# @return [Provider::JSDoc::Object]
|
23
|
+
def for(json_object)
|
24
|
+
@cache ||= {}
|
25
|
+
if proxy_object = @cache[cache_key(json_object)]
|
26
|
+
proxy_object
|
27
|
+
else
|
28
|
+
@cache[cache_key(json_object)] =
|
29
|
+
class_for(json_object).new(json_object)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
# Returns a Proxy class for the given +json_object+
|
36
|
+
#
|
37
|
+
# @param json_object [Hash]
|
38
|
+
# @return [Class]
|
39
|
+
def class_for(json_object)
|
40
|
+
class_name = json_object['object_type']
|
41
|
+
Reader::Object.const_get(class_name)
|
42
|
+
rescue NameError
|
43
|
+
Reader::Object::Base
|
44
|
+
end
|
45
|
+
|
46
|
+
# Returns a cache key for the given +json_object+
|
47
|
+
#
|
48
|
+
# @param json_object [Hash]
|
49
|
+
# @return [String]
|
50
|
+
def cache_key(json_object)
|
51
|
+
[
|
52
|
+
json_object['id'],
|
53
|
+
json_object['module_id'],
|
54
|
+
json_object['signature']
|
55
|
+
].map(&:to_s).join('.')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
module Inch
|
2
|
+
module Language
|
3
|
+
module Elixir
|
4
|
+
module Provider
|
5
|
+
module Reader
|
6
|
+
module Object
|
7
|
+
# @abstract
|
8
|
+
class Base
|
9
|
+
# @param hash [Hash] hash returned via JSON interface
|
10
|
+
def initialize(hash)
|
11
|
+
@hash = hash
|
12
|
+
end
|
13
|
+
|
14
|
+
def name
|
15
|
+
@hash['name']
|
16
|
+
end
|
17
|
+
|
18
|
+
def fullname
|
19
|
+
raise NotImplementedError
|
20
|
+
end
|
21
|
+
|
22
|
+
def files
|
23
|
+
[]
|
24
|
+
end
|
25
|
+
|
26
|
+
def filename
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
|
30
|
+
def children_fullnames
|
31
|
+
[] # raise NotImplementedError
|
32
|
+
end
|
33
|
+
|
34
|
+
def parent_fullname
|
35
|
+
false # raise NotImplementedError
|
36
|
+
end
|
37
|
+
|
38
|
+
def api_tag?
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def aliased_object_fullname
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
|
46
|
+
def aliases_fullnames
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
|
50
|
+
def attributes
|
51
|
+
[]
|
52
|
+
end
|
53
|
+
|
54
|
+
def bang_name?
|
55
|
+
false
|
56
|
+
end
|
57
|
+
|
58
|
+
def constant?
|
59
|
+
false # raise NotImplementedError
|
60
|
+
end
|
61
|
+
|
62
|
+
def constructor?
|
63
|
+
false
|
64
|
+
end
|
65
|
+
|
66
|
+
def depth
|
67
|
+
fullname.split('.').size
|
68
|
+
end
|
69
|
+
|
70
|
+
def docstring
|
71
|
+
@hash['doc'] # raise NotImplementedError
|
72
|
+
end
|
73
|
+
|
74
|
+
def getter?
|
75
|
+
name =~ /^get_/ # raise NotImplementedError
|
76
|
+
end
|
77
|
+
|
78
|
+
def has_children?
|
79
|
+
false # raise NotImplementedError
|
80
|
+
end
|
81
|
+
|
82
|
+
def has_code_example?
|
83
|
+
false # raise NotImplementedError
|
84
|
+
end
|
85
|
+
|
86
|
+
def has_doc?
|
87
|
+
!undocumented?
|
88
|
+
end
|
89
|
+
|
90
|
+
def has_multiple_code_examples?
|
91
|
+
false # raise NotImplementedError
|
92
|
+
end
|
93
|
+
|
94
|
+
def has_unconsidered_tags?
|
95
|
+
false # raise NotImplementedError
|
96
|
+
end
|
97
|
+
|
98
|
+
def method?
|
99
|
+
false
|
100
|
+
end
|
101
|
+
|
102
|
+
def nodoc?
|
103
|
+
@hash['doc'] == false
|
104
|
+
end
|
105
|
+
|
106
|
+
def namespace?
|
107
|
+
false
|
108
|
+
end
|
109
|
+
|
110
|
+
def original_docstring
|
111
|
+
@hash['doc']
|
112
|
+
end
|
113
|
+
|
114
|
+
def overridden?
|
115
|
+
false # raise NotImplementedError
|
116
|
+
end
|
117
|
+
|
118
|
+
def overridden_method_fullname
|
119
|
+
nil # raise NotImplementedError
|
120
|
+
end
|
121
|
+
|
122
|
+
def parameters
|
123
|
+
[] # raise NotImplementedError
|
124
|
+
end
|
125
|
+
|
126
|
+
def private?
|
127
|
+
false
|
128
|
+
end
|
129
|
+
|
130
|
+
def tagged_as_internal_api?
|
131
|
+
false
|
132
|
+
end
|
133
|
+
|
134
|
+
def tagged_as_private?
|
135
|
+
nodoc?
|
136
|
+
end
|
137
|
+
|
138
|
+
def protected?
|
139
|
+
false
|
140
|
+
end
|
141
|
+
|
142
|
+
def public?
|
143
|
+
true
|
144
|
+
end
|
145
|
+
|
146
|
+
def questioning_name?
|
147
|
+
fullname =~ /\?$/
|
148
|
+
end
|
149
|
+
|
150
|
+
def return_described?
|
151
|
+
false # raise NotImplementedError
|
152
|
+
end
|
153
|
+
|
154
|
+
def return_mentioned?
|
155
|
+
false # raise NotImplementedError
|
156
|
+
end
|
157
|
+
|
158
|
+
def return_typed?
|
159
|
+
false # raise NotImplementedError
|
160
|
+
end
|
161
|
+
|
162
|
+
def in_root?
|
163
|
+
depth == 1
|
164
|
+
end
|
165
|
+
|
166
|
+
def setter?
|
167
|
+
name =~ /^set_/ # raise NotImplementedError
|
168
|
+
end
|
169
|
+
|
170
|
+
def source
|
171
|
+
nil
|
172
|
+
end
|
173
|
+
|
174
|
+
def unconsidered_tag_count
|
175
|
+
0
|
176
|
+
end
|
177
|
+
|
178
|
+
def undocumented?
|
179
|
+
@hash['doc'].nil?
|
180
|
+
end
|
181
|
+
|
182
|
+
def visibility
|
183
|
+
:public
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Inch
|
2
|
+
module Language
|
3
|
+
module Elixir
|
4
|
+
module Provider
|
5
|
+
module Reader
|
6
|
+
module Object
|
7
|
+
# Proxy class for functions
|
8
|
+
class FunctionObject < Base
|
9
|
+
def name
|
10
|
+
@hash['id']
|
11
|
+
end
|
12
|
+
|
13
|
+
def fullname
|
14
|
+
@hash['module_id'] + "." + @hash['id']
|
15
|
+
end
|
16
|
+
|
17
|
+
def method?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Inch
|
2
|
+
module Language
|
3
|
+
module Elixir
|
4
|
+
module Provider
|
5
|
+
module Reader
|
6
|
+
module Object
|
7
|
+
# Proxy class for modules
|
8
|
+
class ModuleObject < Base
|
9
|
+
def fullname
|
10
|
+
@hash['id']
|
11
|
+
end
|
12
|
+
|
13
|
+
def namespace?
|
14
|
+
true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "json"
|
2
|
+
require "inch/language/elixir/provider/reader/object"
|
3
|
+
|
4
|
+
module Inch
|
5
|
+
module Language
|
6
|
+
module Elixir
|
7
|
+
module Provider
|
8
|
+
module Reader
|
9
|
+
# Parses the source tree (using Reader)
|
10
|
+
class Parser
|
11
|
+
attr_reader :parsed_objects
|
12
|
+
|
13
|
+
# Helper method to parse an instance with the given +args+
|
14
|
+
#
|
15
|
+
# @see #parse
|
16
|
+
# @return [CodeObject::Provider::Reader::Parser] the instance that ran
|
17
|
+
def self.parse(*args)
|
18
|
+
parser = new
|
19
|
+
parser.parse(*args)
|
20
|
+
parser
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param dir [String] directory
|
24
|
+
# @param config [Inch::Config::Codebase] configuration for codebase
|
25
|
+
# @return [void]
|
26
|
+
def parse(dir, config)
|
27
|
+
Dir.chdir(dir) do
|
28
|
+
parse_objects(config.included_files, config.excluded_files,
|
29
|
+
config.read_dump_file)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Array<YARD::Object::Base>]
|
34
|
+
def objects
|
35
|
+
@objects ||= parsed_objects.map do |o|
|
36
|
+
Reader::Object.for(o) # unless IGNORE_TYPES.include?(o.type)
|
37
|
+
end.compact
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def parse_objects(paths, excluded, read_dump_file = nil)
|
43
|
+
if read_dump_file.nil?
|
44
|
+
raise "Elixir analysis only works with --read-from-dump."
|
45
|
+
else
|
46
|
+
output = File.read(read_dump_file)
|
47
|
+
end
|
48
|
+
@parsed_objects = JSON[output]['objects']
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|