inch 0.5.0.rc5 → 0.5.0.rc6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -6
  3. data/.rubocop_todo.yml +40 -34
  4. data/Gemfile +3 -3
  5. data/Rakefile +10 -6
  6. data/bin/inch +5 -5
  7. data/config/base.rb +4 -4
  8. data/config/nodejs.rb +44 -1
  9. data/config/ruby.rb +1 -1
  10. data/inch.gemspec +17 -17
  11. data/lib/inch.rb +13 -13
  12. data/lib/inch/api.rb +10 -10
  13. data/lib/inch/api/compare.rb +2 -2
  14. data/lib/inch/api/compare/code_objects.rb +1 -1
  15. data/lib/inch/api/diff.rb +1 -1
  16. data/lib/inch/api/options/suggest.rb +1 -1
  17. data/lib/inch/api/suggest.rb +1 -1
  18. data/lib/inch/cli.rb +6 -6
  19. data/lib/inch/cli/command.rb +15 -15
  20. data/lib/inch/cli/command/base.rb +5 -3
  21. data/lib/inch/cli/command/base_list.rb +0 -1
  22. data/lib/inch/cli/command/console.rb +5 -5
  23. data/lib/inch/cli/command/diff.rb +6 -6
  24. data/lib/inch/cli/command/inspect.rb +5 -5
  25. data/lib/inch/cli/command/list.rb +4 -4
  26. data/lib/inch/cli/command/options/base.rb +17 -15
  27. data/lib/inch/cli/command/options/base_list.rb +17 -17
  28. data/lib/inch/cli/command/options/base_object.rb +1 -1
  29. data/lib/inch/cli/command/options/console.rb +13 -13
  30. data/lib/inch/cli/command/options/diff.rb +19 -19
  31. data/lib/inch/cli/command/options/inspect.rb +5 -5
  32. data/lib/inch/cli/command/options/list.rb +7 -7
  33. data/lib/inch/cli/command/options/show.rb +5 -5
  34. data/lib/inch/cli/command/options/stats.rb +2 -2
  35. data/lib/inch/cli/command/options/suggest.rb +12 -12
  36. data/lib/inch/cli/command/output/base.rb +1 -1
  37. data/lib/inch/cli/command/output/diff.rb +9 -9
  38. data/lib/inch/cli/command/output/inspect.rb +13 -13
  39. data/lib/inch/cli/command/output/list.rb +1 -1
  40. data/lib/inch/cli/command/output/show.rb +4 -4
  41. data/lib/inch/cli/command/output/stats.rb +14 -14
  42. data/lib/inch/cli/command/output/suggest.rb +14 -14
  43. data/lib/inch/cli/command/show.rb +4 -4
  44. data/lib/inch/cli/command/stats.rb +4 -4
  45. data/lib/inch/cli/command/suggest.rb +4 -4
  46. data/lib/inch/cli/command_parser.rb +4 -4
  47. data/lib/inch/cli/sparkline_helper.rb +1 -1
  48. data/lib/inch/cli/trace_helper.rb +1 -1
  49. data/lib/inch/cli/yardopts_helper.rb +1 -1
  50. data/lib/inch/code_object.rb +3 -3
  51. data/lib/inch/code_object/provider.rb +3 -3
  52. data/lib/inch/code_object/proxy.rb +3 -4
  53. data/lib/inch/codebase.rb +5 -5
  54. data/lib/inch/codebase/object.rb +2 -1
  55. data/lib/inch/codebase/serializer.rb +2 -2
  56. data/lib/inch/config.rb +6 -6
  57. data/lib/inch/config/codebase.rb +5 -5
  58. data/lib/inch/core_ext.rb +1 -1
  59. data/lib/inch/core_ext/string.rb +1 -1
  60. data/lib/inch/evaluation.rb +8 -8
  61. data/lib/inch/evaluation/proxy.rb +2 -3
  62. data/lib/inch/evaluation/role.rb +1 -1
  63. data/lib/inch/language/elixir/code_object/base.rb +6 -4
  64. data/lib/inch/language/elixir/evaluation/base.rb +2 -1
  65. data/lib/inch/language/elixir/evaluation/function_object.rb +1 -1
  66. data/lib/inch/language/elixir/import.rb +14 -14
  67. data/lib/inch/language/elixir/provider/reader.rb +1 -1
  68. data/lib/inch/language/elixir/provider/reader/docstring.rb +13 -0
  69. data/lib/inch/language/elixir/provider/reader/object.rb +5 -5
  70. data/lib/inch/language/elixir/provider/reader/object/base.rb +13 -5
  71. data/lib/inch/language/elixir/provider/reader/object/function_object.rb +1 -1
  72. data/lib/inch/language/elixir/provider/reader/parser.rb +21 -7
  73. data/lib/inch/language/elixir/roles/base.rb +3 -3
  74. data/lib/inch/language/elixir/roles/function.rb +2 -1
  75. data/lib/inch/language/elixir/roles/object.rb +1 -1
  76. data/lib/inch/language/nodejs/code_object/base.rb +199 -0
  77. data/lib/inch/language/nodejs/code_object/function_object.rb +74 -0
  78. data/lib/inch/language/nodejs/code_object/member_object.rb +11 -0
  79. data/lib/inch/language/nodejs/code_object/module_object.rb +23 -0
  80. data/lib/inch/language/nodejs/evaluation/base.rb +29 -0
  81. data/lib/inch/language/nodejs/evaluation/function_object.rb +31 -0
  82. data/lib/inch/language/nodejs/evaluation/member_object.rb +11 -0
  83. data/lib/inch/language/nodejs/evaluation/module_object.rb +27 -0
  84. data/lib/inch/language/nodejs/import.rb +17 -1
  85. data/lib/inch/language/nodejs/provider/jsdoc.rb +1 -1
  86. data/lib/inch/language/nodejs/provider/jsdoc/docstring.rb +13 -0
  87. data/lib/inch/language/nodejs/provider/jsdoc/object.rb +16 -8
  88. data/lib/inch/language/nodejs/provider/jsdoc/object/base.rb +82 -45
  89. data/lib/inch/language/nodejs/provider/jsdoc/object/function_object.rb +18 -0
  90. data/lib/inch/language/nodejs/provider/jsdoc/object/member_object.rb +15 -0
  91. data/lib/inch/language/nodejs/provider/jsdoc/object/module_object.rb +22 -0
  92. data/lib/inch/language/nodejs/provider/jsdoc/parser.rb +9 -10
  93. data/lib/inch/language/nodejs/roles/base.rb +32 -0
  94. data/lib/inch/language/nodejs/roles/function.rb +113 -0
  95. data/lib/inch/language/nodejs/roles/member.rb +13 -0
  96. data/lib/inch/language/nodejs/roles/module.rb +64 -0
  97. data/lib/inch/language/nodejs/roles/object.rb +76 -0
  98. data/lib/inch/language/ruby/code_object/base.rb +6 -4
  99. data/lib/inch/language/ruby/evaluation/base.rb +2 -1
  100. data/lib/inch/language/ruby/evaluation/method_object.rb +2 -1
  101. data/lib/inch/language/ruby/import.rb +24 -24
  102. data/lib/inch/language/ruby/provider/yard.rb +10 -10
  103. data/lib/inch/language/ruby/provider/yard/nodoc_helper.rb +2 -2
  104. data/lib/inch/language/ruby/provider/yard/object.rb +9 -9
  105. data/lib/inch/language/ruby/provider/yard/object/base.rb +25 -28
  106. data/lib/inch/language/ruby/provider/yard/object/method_object.rb +4 -3
  107. data/lib/inch/language/ruby/provider/yard/object/method_parameter_object.rb +4 -3
  108. data/lib/inch/language/ruby/provider/yard/object/method_signature.rb +2 -2
  109. data/lib/inch/language/ruby/provider/yard/object/namespace_object.rb +2 -1
  110. data/lib/inch/language/ruby/provider/yard/parser.rb +2 -2
  111. data/lib/inch/language/ruby/roles/base.rb +1 -1
  112. data/lib/inch/language/ruby/roles/method.rb +2 -1
  113. data/lib/inch/language/ruby/roles/method_parameter.rb +1 -1
  114. data/lib/inch/language/ruby/roles/missing.rb +2 -2
  115. data/lib/inch/language/ruby/roles/object.rb +6 -6
  116. data/lib/inch/rake.rb +2 -2
  117. data/lib/inch/rake/suggest.rb +5 -5
  118. data/lib/inch/utils/code_location.rb +12 -0
  119. data/lib/inch/utils/read_write_methods.rb +2 -2
  120. data/lib/inch/utils/ui.rb +8 -8
  121. data/lib/inch/version.rb +1 -1
  122. data/test/fixtures/elixir/simple/all.json +321 -0
  123. data/test/integration/api/compare/codebases.rb +6 -6
  124. data/test/integration/cli/command/console_test.rb +13 -13
  125. data/test/integration/cli/command/diff_test.rb +12 -14
  126. data/test/integration/cli/command/inspect_test.rb +30 -30
  127. data/test/integration/cli/command/list_test.rb +34 -34
  128. data/test/integration/cli/command/show_test.rb +26 -26
  129. data/test/integration/cli/command/stats_test.rb +23 -23
  130. data/test/integration/cli/command/suggest_test.rb +58 -49
  131. data/test/integration/stats_options_test.rb +9 -9
  132. data/test/integration/visibility_options_test.rb +49 -45
  133. data/test/shared/base_list.rb +41 -41
  134. data/test/test_helper.rb +18 -10
  135. data/test/unit/api/filter_test.rb +9 -9
  136. data/test/unit/api/get_test.rb +6 -6
  137. data/test/unit/api/list_test.rb +3 -3
  138. data/test/unit/api/options/base_test.rb +6 -6
  139. data/test/unit/api/stats_test.rb +3 -3
  140. data/test/unit/api/suggest_test.rb +4 -4
  141. data/test/unit/cli/arguments_test.rb +25 -25
  142. data/test/unit/cli/command/base_test.rb +3 -3
  143. data/test/unit/cli/command/options/base_list_test.rb +14 -14
  144. data/test/unit/cli/command/options/base_object_test.rb +6 -6
  145. data/test/unit/cli/command/options/base_test.rb +3 -3
  146. data/test/unit/cli/command_parser_test.rb +29 -29
  147. data/test/unit/cli/trace_helper_test.rb +2 -2
  148. data/test/unit/cli/yardopts_helper_test.rb +35 -35
  149. data/test/unit/code_object/converter_test.rb +3 -3
  150. data/test/unit/code_object/provider_test.rb +2 -2
  151. data/test/unit/code_object/proxy_test.rb +11 -11
  152. data/test/unit/codebase/objects_test.rb +8 -8
  153. data/test/unit/codebase/proxy_test.rb +5 -5
  154. data/test/unit/config/codebase_test.rb +3 -3
  155. data/test/unit/config_test.rb +4 -4
  156. data/test/unit/evaluation/role_test.rb +8 -8
  157. data/test/unit/language/elixir/code_object/function_object_test.rb +35 -0
  158. data/test/unit/language/ruby/code_object/method_object_test.rb +128 -126
  159. data/test/unit/language/ruby/provider/yard/docstring_test.rb +27 -23
  160. data/test/unit/language/ruby/provider/yard/nodoc_helper_test.rb +21 -20
  161. data/test/unit/language/ruby/provider/yard/object/method_object_test.rb +20 -17
  162. data/test/unit/language/ruby/provider/yard_test.rb +4 -4
  163. data/test/unit/utils/buffered_ui_test.rb +20 -20
  164. data/test/unit/utils/ui_test.rb +20 -20
  165. data/test/unit/utils/weighted_list_test.rb +7 -7
  166. metadata +25 -2
@@ -1,11 +1,11 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
2
 
3
3
  class Tracer
4
4
  include ::Inch::CLI::TraceHelper
5
5
  end
6
6
 
7
7
  describe ::Inch::CLI::TraceHelper do
8
- it "should be a UI instance" do
8
+ it 'should be a UI instance' do
9
9
  @instance = Tracer.new
10
10
  assert @instance.ui.is_a?(Inch::Utils::UI)
11
11
  end
@@ -1,85 +1,85 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
2
 
3
3
  describe ::Inch::CLI::YardoptsHelper do
4
4
  before do
5
5
  Dir.chdir fixture_path(:ruby, :yardopts)
6
- assert File.file?(".yardopts")
6
+ assert File.file?('.yardopts')
7
7
  @command = ::Inch::CLI::Command::List
8
8
  end
9
9
 
10
- it "should run without args" do
10
+ it 'should run without args' do
11
11
  out, err = capture_io do
12
12
  @command.run
13
13
  end
14
- refute out.empty?, "there should be some output"
15
- assert err.empty?, "there should be no errors"
16
- assert_match /\bFoo\b/, out
17
- assert_match /\bFoo::Bar\b/, out
18
- assert_match /\bFoo::Bar#initialize\b/, out
14
+ refute out.empty?, 'there should be some output'
15
+ assert err.empty?, 'there should be no errors'
16
+ assert_match(/\bFoo\b/, out)
17
+ assert_match(/\bFoo::Bar\b/, out)
18
+ assert_match(/\bFoo::Bar#initialize\b/, out)
19
19
  end
20
20
 
21
- it "should run with --no-yardopts" do
21
+ it 'should run with --no-yardopts' do
22
22
  out, err = capture_io do
23
- @instance = @command.run("app/**/*.rb", "--no-yardopts")
23
+ @instance = @command.run('app/**/*.rb', '--no-yardopts')
24
24
  end
25
- assert out.empty?, "there should be no output"
26
- assert err.empty?, "there should be no errors"
25
+ assert out.empty?, 'there should be no output'
26
+ assert err.empty?, 'there should be no errors'
27
27
  end
28
28
 
29
- it "should run with a given path and .yardopts" do
29
+ it 'should run with a given path and .yardopts' do
30
30
  out, err = capture_io do
31
31
  # lib/something*.rb doesnot exist in the fixture, it is just given as
32
32
  # a command-line path to check if it appears in the parsed filelist
33
- @instance = @command.run("lib/something*.rb")
33
+ @instance = @command.run('lib/something*.rb')
34
34
  end
35
- refute out.empty?, "there should be no output"
36
- assert err.empty?, "there should be no errors"
35
+ refute out.empty?, 'there should be no output'
36
+ assert err.empty?, 'there should be no errors'
37
37
  end
38
38
 
39
- it "should parse options with --no-yardopts" do
39
+ it 'should parse options with --no-yardopts' do
40
40
  @options = ::Inch::CLI::Command::Options::List.new
41
- @options.parse(["app/**/*.rb", "--no-yardopts"])
42
- assert_equal ["app/**/*.rb"], @options.paths
41
+ @options.parse(['app/**/*.rb', '--no-yardopts'])
42
+ assert_equal ['app/**/*.rb'], @options.paths
43
43
  end
44
44
 
45
- it "should parse options with a given path and .yardopts" do
45
+ it 'should parse options with a given path and .yardopts' do
46
46
  # lib/something*.rb doesnot exist in the fixture, it is just given as
47
47
  # a command-line path to check if it appears in the parsed filelist
48
48
  @options = ::Inch::CLI::Command::Options::List.new
49
- @options.parse(["lib/something*.rb"])
50
- assert_equal ["foo/**/*.rb", "lib/something*.rb"], @options.paths
49
+ @options.parse(['lib/something*.rb'])
50
+ assert_equal ['foo/**/*.rb', 'lib/something*.rb'], @options.paths
51
51
  end
52
52
 
53
- it "should output info when run with --help" do
53
+ it 'should output info when run with --help' do
54
54
  out, err = capture_io do
55
- assert_raises(SystemExit) { @command.run("--help") }
55
+ assert_raises(SystemExit) { @command.run('--help') }
56
56
  end
57
- refute out.empty?, "there should be some output"
58
- assert_match /\bUsage\b.+list/, out
57
+ refute out.empty?, 'there should be some output'
58
+ assert_match(/\bUsage\b.+list/, out)
59
59
  # assert_match /\b\-\-\[no\-\]yardopts\b/, out,
60
60
  # "--[no-]yardopts should be mentioned"
61
- assert err.empty?, "there should be no errors"
61
+ assert err.empty?, 'there should be no errors'
62
62
  end
63
63
  end
64
64
 
65
65
  describe ::Inch::CLI::YardoptsHelper do
66
66
  before do
67
67
  Dir.chdir fixture_path(:ruby, :simple)
68
- refute File.file?(".yardopts")
69
- refute File.file?(".document")
68
+ refute File.file?('.yardopts')
69
+ refute File.file?('.document')
70
70
  @command = ::Inch::CLI::Command::List
71
71
  end
72
72
 
73
- it "should not interfere with paths in arguments" do
73
+ it 'should not interfere with paths in arguments' do
74
74
  @options = ::Inch::CLI::Command::Options::List.new
75
- @options.parse(["lib/**/foo*.rb"])
76
- assert_equal ["lib/**/foo*.rb"], @options.paths
75
+ @options.parse(['lib/**/foo*.rb'])
76
+ assert_equal ['lib/**/foo*.rb'], @options.paths
77
77
  end
78
78
 
79
- it "should not intefer with --all at the end" do
79
+ it 'should not intefer with --all at the end' do
80
80
  @options = ::Inch::CLI::Command::Options::List.new
81
- @options.parse(["lib/**/foo*.rb", "--all"])
82
- assert_equal ["lib/**/foo*.rb"], @options.paths
81
+ @options.parse(['lib/**/foo*.rb', '--all'])
82
+ assert_equal ['lib/**/foo*.rb'], @options.paths
83
83
  end
84
84
 
85
85
  end
@@ -1,9 +1,9 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
2
 
3
3
  describe ::Inch::CodeObject::Converter do
4
4
  class MockObject
5
5
  def docstring
6
- "Foo::Bar"
6
+ 'Foo::Bar'
7
7
  end
8
8
 
9
9
  def parameters
@@ -20,7 +20,7 @@ describe ::Inch::CodeObject::Converter do
20
20
  end
21
21
 
22
22
  let(:object) { MockObject.new }
23
- it "should parse all objects" do
23
+ it 'should parse all objects' do
24
24
  attributes = ::Inch::CodeObject::Converter.to_hash(object)
25
25
  assert_equal object.docstring, attributes[:docstring]
26
26
  assert_equal object.public?, attributes[:public?]
@@ -1,7 +1,7 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
2
 
3
3
  describe ::Inch::CodeObject::Provider do
4
- it "should parse all objects" do
4
+ it 'should parse all objects' do
5
5
  Dir.chdir File.dirname(__FILE__)
6
6
  @provider = ::Inch::CodeObject::Provider.parse(fixture_path(:ruby, :simple))
7
7
  refute @provider.objects.empty?
@@ -1,49 +1,49 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
2
 
3
3
  describe ::Inch::CodeObject::Proxy do
4
4
  before do
5
- @codebase = test_codebase(:code_examples)
5
+ @codebase = test_codebase(:ruby, :code_examples)
6
6
  @objects = @codebase.objects
7
7
  end
8
8
 
9
9
  def test_inspect_gives_original_name
10
- m = @objects.find("Foo::Bar#method_with_code_example")
11
- assert_match /Foo::Bar#method_with_code_example/, m.inspect
10
+ m = @objects.find('Foo::Bar#method_with_code_example')
11
+ assert_match(/Foo::Bar#method_with_code_example/, m.inspect)
12
12
  end
13
13
 
14
14
  def test_grade_is_not_nil
15
- m = @objects.find("Foo::Bar#method_with_code_example")
15
+ m = @objects.find('Foo::Bar#method_with_code_example')
16
16
  assert m.grade
17
17
  end
18
18
 
19
19
  def test_method_with_code_example
20
- m = @objects.find("Foo::Bar#method_with_code_example")
20
+ m = @objects.find('Foo::Bar#method_with_code_example')
21
21
  assert m.has_code_example?
22
22
  end
23
23
 
24
24
  def test_method_with_code_example2
25
- m = @objects.find("Foo::Bar#method_with_code_example2")
25
+ m = @objects.find('Foo::Bar#method_with_code_example2')
26
26
  assert m.has_code_example?
27
27
  end
28
28
 
29
29
  def test_method_with_code_examples
30
- m = @objects.find("Foo::Bar#method_with_one_example")
30
+ m = @objects.find('Foo::Bar#method_with_one_example')
31
31
  assert m.has_code_example?
32
32
  refute m.has_multiple_code_examples?
33
33
  end
34
34
 
35
35
  def test_method_with_code_examples
36
- m = @objects.find("Foo::Bar#method_with_examples")
36
+ m = @objects.find('Foo::Bar#method_with_examples')
37
37
  assert m.has_multiple_code_examples?
38
38
  end
39
39
 
40
40
  def test_method_with_code_examples
41
- m = @objects.find("Foo::Bar#method_with_tagged_example")
41
+ m = @objects.find('Foo::Bar#method_with_tagged_example')
42
42
  assert m.has_multiple_code_examples?
43
43
  end
44
44
 
45
45
  def test_method_with_code_examples
46
- m = @objects.find("Foo::Bar#method_with_2tagged_examples")
46
+ m = @objects.find('Foo::Bar#method_with_2tagged_examples')
47
47
  assert m.has_multiple_code_examples?
48
48
  end
49
49
  end
@@ -1,22 +1,22 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
2
 
3
3
  describe ::Inch::Codebase::Objects do
4
4
  before do
5
- @codebase = test_codebase(:simple)
5
+ @codebase = test_codebase(:ruby, :simple)
6
6
  @objects = @codebase.objects
7
7
  end
8
8
 
9
- it "should parse all objects" do
9
+ it 'should parse all objects' do
10
10
  refute @objects.empty?
11
11
  end
12
12
 
13
- it "should find some objects" do
14
- refute_nil @objects.find("Foo")
15
- refute_nil @objects.find("Foo::Bar")
16
- refute_nil @objects.find("Foo::Bar#method_without_doc")
13
+ it 'should find some objects' do
14
+ refute_nil @objects.find('Foo')
15
+ refute_nil @objects.find('Foo::Bar')
16
+ refute_nil @objects.find('Foo::Bar#method_without_doc')
17
17
  end
18
18
 
19
- it "should support iteration" do
19
+ it 'should support iteration' do
20
20
  sum = 0
21
21
  @objects.each do
22
22
  sum += 1
@@ -1,17 +1,17 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
2
 
3
3
  describe ::Inch::Codebase::Proxy do
4
- it "should parse all objects" do
4
+ it 'should parse all objects' do
5
5
  dir = fixture_path(:ruby, :simple)
6
- config = Inch::Config::Codebase.new(:ruby, ["lib/**/*.rb"])
6
+ config = Inch::Config::Codebase.new(:ruby, ['lib/**/*.rb'])
7
7
  config.object_provider :YARD
8
8
  @codebase = Inch::Codebase::Proxy.parse dir, config
9
9
  refute_nil @codebase.objects
10
10
  end
11
11
 
12
- it "should parse given paths" do
12
+ it 'should parse given paths' do
13
13
  dir = fixture_path(:ruby, :simple)
14
- config = Inch::Config::Codebase.new(:ruby, ["app/**/*.rb"])
14
+ config = Inch::Config::Codebase.new(:ruby, ['app/**/*.rb'])
15
15
  config.object_provider :YARD
16
16
  @codebase = Inch::Codebase::Proxy.parse dir, config
17
17
  assert @codebase.objects.empty?
@@ -1,7 +1,7 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
2
 
3
3
  describe ::Inch::Config::Codebase do
4
- it "should parse .inch.yml" do
4
+ it 'should parse .inch.yml' do
5
5
  dir = fixture_path(:ruby, :simple)
6
6
  config = Inch::Config::Codebase.new
7
7
  config.update_via_yaml(dir)
@@ -9,7 +9,7 @@ describe ::Inch::Config::Codebase do
9
9
  assert config.excluded_files.empty?
10
10
  end
11
11
 
12
- it "should parse .inch.yml if present" do
12
+ it 'should parse .inch.yml if present' do
13
13
  dir = fixture_path(:ruby, :"inch-yml")
14
14
  config = Inch::Config::Codebase.new
15
15
  config.update_via_yaml(dir)
@@ -1,13 +1,13 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
2
 
3
3
  describe ::Inch::Config do
4
- it "should return config for :ruby" do
4
+ it 'should return config for :ruby' do
5
5
  config = Inch::Config.for(:ruby)
6
6
  refute config.codebase.included_files.empty?
7
7
  assert config.codebase.excluded_files.empty?
8
8
  end
9
9
 
10
- it "should parse .inch.yml if present" do
10
+ it 'should parse .inch.yml if present' do
11
11
  dir = fixture_path(:ruby, :"inch-yml")
12
12
  config = Inch::Config.for(:ruby, dir)
13
13
  refute config.codebase.included_files.empty?
@@ -20,7 +20,7 @@ describe ::Inch::Config do
20
20
  assert config.codebase.excluded_files.empty?
21
21
  end
22
22
 
23
- it "should return config.evaluation for :ruby" do
23
+ it 'should return config.evaluation for :ruby' do
24
24
  config = Inch::Config.for(:ruby)
25
25
  refute_nil config.evaluation.criteria_for(:MethodObject)
26
26
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
2
 
3
3
  class MockPrivateRole < ::Inch::Evaluation::Role
4
4
  applicable_if :private?
@@ -39,31 +39,31 @@ class MockPublicObject
39
39
  end
40
40
 
41
41
  describe ::Inch::Evaluation::Role do
42
- describe ".applicable" do
42
+ describe '.applicable' do
43
43
  let(:private_object) { MockPrivateObject.new }
44
44
  let(:public_object) { MockPublicObject.new }
45
45
 
46
- describe ".applicable_if" do
47
- it "should work with a symbol" do
46
+ describe '.applicable_if' do
47
+ it 'should work with a symbol' do
48
48
  assert MockPrivateRole.applicable?(private_object)
49
49
  assert !MockPrivateRole.applicable?(public_object)
50
50
  end
51
51
 
52
- it "should work with a block" do
52
+ it 'should work with a block' do
53
53
  assert MockPublicRole.applicable?(public_object)
54
54
  assert MockNotPrivateRole.applicable?(public_object)
55
55
  assert !MockPublicRole.applicable?(private_object)
56
56
  end
57
57
  end
58
58
 
59
- describe ".applicable_unless" do
60
- it "should work with a block" do
59
+ describe '.applicable_unless' do
60
+ it 'should work with a block' do
61
61
  assert MockNotPrivateRole.applicable?(public_object)
62
62
  assert !MockNotPrivateRole.applicable?(private_object)
63
63
  end
64
64
  end
65
65
 
66
- it "should work by implementing a class method" do
66
+ it 'should work by implementing a class method' do
67
67
  assert MockIndifferentRole.applicable?(private_object)
68
68
  assert MockIndifferentRole.applicable?(public_object)
69
69
  end
@@ -0,0 +1,35 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../test_helper')
2
+
3
+ describe ::Inch::Language::Elixir::CodeObject::FunctionObject do
4
+ before do
5
+ @codebase = fresh_codebase(:elixir, :simple, 'all.json')
6
+ @objects = @codebase.objects
7
+ end
8
+
9
+ describe 'Scores' do
10
+ #
11
+ it 'should not' do
12
+ m = @objects.find('InchEx.generate_docs/3')
13
+ assert m.score > 50
14
+ end
15
+ end
16
+
17
+ it 'should recognize the relationship between modules and functions' do
18
+ mod = @objects.find('InchEx')
19
+ assert mod.has_children?
20
+ assert mod.children.size > 1
21
+ fun = @objects.find('InchEx.generate_docs/3')
22
+ assert_equal mod, fun.parent
23
+ end
24
+
25
+ it 'should recognize the depth of methods' do
26
+ m = @objects.find('InchEx')
27
+ assert_equal 1, m.depth
28
+ m = @objects.find('InchEx.Config')
29
+ assert_equal 2, m.depth
30
+ m = @objects.find('InchEx.Docs.Formatter')
31
+ assert_equal 3, m.depth
32
+ m = @objects.find('InchEx.Docs.Formatter.run/2')
33
+ assert_equal 4, m.depth
34
+ end
35
+ end
@@ -1,41 +1,41 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../../../test_helper")
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../test_helper')
2
2
 
3
3
  describe ::Inch::Language::Ruby::CodeObject::MethodObject do
4
4
  before do
5
- @codebase = test_codebase(:simple)
5
+ @codebase = test_codebase(:ruby, :simple)
6
6
  @objects = @codebase.objects
7
7
  end
8
8
 
9
- describe "Scores" do
9
+ describe 'Scores' do
10
10
  #
11
- it "should not count tags that are transitive" do
12
- m = @objects.find("InchTest::Deprecated::ClassMethods")
11
+ it 'should not count tags that are transitive' do
12
+ m = @objects.find('InchTest::Deprecated::ClassMethods')
13
13
  assert_equal 0, m.score
14
14
  assert m.undocumented?
15
15
  end
16
16
 
17
- it "counts a @raise tag" do
18
- m = @objects.find("InchTest#raising_method_with_comment")
17
+ it 'counts a @raise tag' do
18
+ m = @objects.find('InchTest#raising_method_with_comment')
19
19
  assert m.score > 0
20
20
  refute m.undocumented?
21
21
  end
22
22
 
23
- it "should not count a call to `raise`" do
24
- m = @objects.find("InchTest#raising_method")
23
+ it 'should not count a call to `raise`' do
24
+ m = @objects.find('InchTest#raising_method')
25
25
  assert_equal 0, m.score
26
26
  assert m.undocumented?
27
27
  end
28
28
 
29
- it "should not count a call to `yield`" do
30
- m = @objects.find("InchTest#yielding_method")
29
+ it 'should not count a call to `yield`' do
30
+ m = @objects.find('InchTest#yielding_method')
31
31
  assert_equal 0, m.score
32
32
  assert m.undocumented?
33
33
  end
34
34
  end
35
35
 
36
- describe "Taggings" do
36
+ describe 'Taggings' do
37
37
  #
38
- it "should recognize forms of @private-tags" do
38
+ it 'should recognize forms of @private-tags' do
39
39
  %w( InchTest#method_with_private_tag
40
40
  InchTest#private_method_with_tomdoc).each do |fullname|
41
41
  m = @objects.find(fullname)
@@ -43,7 +43,7 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
43
43
  end
44
44
  end
45
45
 
46
- it "should recognize forms of internal-tags" do
46
+ it 'should recognize forms of internal-tags' do
47
47
  # @api private in YARD
48
48
  # Internal: in TomDoc
49
49
  %w( InchTest#private_api_with_yard
@@ -54,8 +54,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
54
54
  end
55
55
  end
56
56
 
57
- it "should recognize undocumented methods without parameters" do
58
- m = @objects.find("Foo::Bar#method_without_doc")
57
+ it 'should recognize undocumented methods without parameters' do
58
+ m = @objects.find('Foo::Bar#method_without_doc')
59
59
  refute m.has_doc?
60
60
  refute m.has_parameters?
61
61
  refute m.return_mentioned?
@@ -64,8 +64,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
64
64
  assert_equal 0, m.score
65
65
  end
66
66
 
67
- it "should recognize missing parameter documentation" do
68
- m = @objects.find("Foo::Bar#method_with_missing_param_doc")
67
+ it 'should recognize missing parameter documentation' do
68
+ m = @objects.find('Foo::Bar#method_with_missing_param_doc')
69
69
  assert m.has_doc?
70
70
  assert m.has_parameters?
71
71
  assert m.return_mentioned?
@@ -83,10 +83,10 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
83
83
  assert m.score
84
84
  end
85
85
 
86
- describe "Documentation Styles" do
86
+ describe 'Documentation Styles' do
87
87
  #
88
- it "should handle YARD when no additional docstring is given" do
89
- m = @objects.find("Foo::Bar#method_without_docstring")
88
+ it 'should handle YARD when no additional docstring is given' do
89
+ m = @objects.find('Foo::Bar#method_without_docstring')
90
90
  refute m.has_doc?
91
91
  assert m.has_parameters?
92
92
  assert m.return_mentioned?
@@ -94,8 +94,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
94
94
  assert m.score
95
95
  end
96
96
 
97
- it "should handle YARD when only @return is given" do
98
- m = @objects.find("Foo::Bar#method_without_params_or_docstring")
97
+ it 'should handle YARD when only @return is given' do
98
+ m = @objects.find('Foo::Bar#method_without_params_or_docstring')
99
99
  refute m.has_doc?
100
100
  refute m.has_parameters?
101
101
  assert m.return_mentioned?
@@ -104,16 +104,17 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
104
104
  assert m.score
105
105
  end
106
106
 
107
- it "should handle unusable return value when only @return [void] is given" do
108
- m = @objects.find("Foo::Bar#method_without_usable_return_value")
107
+ it 'should handle unusable return value when only @return [void]' \
108
+ ' is given' do
109
+ m = @objects.find('Foo::Bar#method_without_usable_return_value')
109
110
  assert m.return_mentioned?
110
111
  assert m.return_described?
111
112
 
112
113
  assert m.score
113
114
  end
114
115
 
115
- it "should handle RDoc" do
116
- m = @objects.find("Foo::Bar#method_with_rdoc_doc")
116
+ it 'should handle RDoc' do
117
+ m = @objects.find('Foo::Bar#method_with_rdoc_doc')
117
118
  assert m.has_doc?
118
119
  assert m.has_parameters?
119
120
  p = m.parameter(:param1)
@@ -123,8 +124,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
123
124
  assert m.score
124
125
  end
125
126
 
126
- it "should handle other RDoc styles" do
127
- m = @objects.find("Foo::Bar#method_with_other_rdoc_doc")
127
+ it 'should handle other RDoc styles' do
128
+ m = @objects.find('Foo::Bar#method_with_other_rdoc_doc')
128
129
  assert m.has_doc?
129
130
  assert m.has_parameters?
130
131
  p = m.parameter(:param1)
@@ -138,8 +139,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
138
139
  assert m.score
139
140
  end
140
141
 
141
- it "should handle yet other RDoc styles" do
142
- m = @objects.find("Foo::Bar#method_with_yet_another_rdoc_doc")
142
+ it 'should handle yet other RDoc styles' do
143
+ m = @objects.find('Foo::Bar#method_with_yet_another_rdoc_doc')
143
144
  assert m.has_doc?
144
145
  assert m.has_parameters?
145
146
  p = m.parameter(:param1)
@@ -150,8 +151,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
150
151
  assert m.score
151
152
  end
152
153
 
153
- it "should handle unstructured doc styles" do
154
- m = @objects.find("Foo::Bar#method_with_unstructured_doc")
154
+ it 'should handle unstructured doc styles' do
155
+ m = @objects.find('Foo::Bar#method_with_unstructured_doc')
155
156
  assert m.has_doc?
156
157
  assert m.has_parameters?
157
158
  p = m.parameter(:param1)
@@ -161,8 +162,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
161
162
  assert m.score
162
163
  end
163
164
 
164
- it "should handle unstructured doc styles with an undocumented param" do
165
- m = @objects.find("Foo::Bar#method_with_unstructured_doc_missing_params")
165
+ it 'should handle unstructured doc styles with an undocumented param' do
166
+ m = @objects.find('Foo::Bar#method_with_unstructured_doc_missing_params')
166
167
  assert m.has_doc?
167
168
  assert m.has_parameters?
168
169
  p = m.parameter(:format)
@@ -172,9 +173,9 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
172
173
  assert m.score
173
174
  end
174
175
 
175
- it "should handle methods (without parameters) that have only a docstring" \
176
- " (text comment)" do
177
- m = @objects.find("Foo::Bar#method_without_params_or_return_type")
176
+ it 'should handle methods (without parameters) that have only a docstring' \
177
+ ' (text comment)' do
178
+ m = @objects.find('Foo::Bar#method_without_params_or_return_type')
178
179
  assert m.has_doc?
179
180
  refute m.has_parameters?
180
181
  refute m.return_mentioned?
@@ -183,164 +184,165 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
183
184
  end
184
185
  end
185
186
 
186
- describe "Getter/Setter Handling" do
187
+ describe 'Getter/Setter Handling' do
187
188
 
188
- it "should recognize a getter method" do
189
- m = @objects.find("InchTest#getter")
190
- assert m.getter?, "should be a getter"
189
+ it 'should recognize a getter method' do
190
+ m = @objects.find('InchTest#getter')
191
+ assert m.getter?, 'should be a getter'
191
192
  refute m.setter?
192
193
  refute m.has_doc?
193
194
  assert_equal 0, m.score
194
195
  end
195
196
 
196
- it "should recognize a setter method" do
197
- m = @objects.find("InchTest#attr_setter=")
197
+ it 'should recognize a setter method' do
198
+ m = @objects.find('InchTest#attr_setter=')
198
199
  refute m.getter?
199
- assert m.setter?, "should be a setter"
200
+ assert m.setter?, 'should be a setter'
200
201
  refute m.has_doc?
201
202
  assert_equal 0, m.score
202
203
  end
203
204
 
204
- it "should recognize a manually defined setter method" do
205
- m = @objects.find("InchTest#manual_setter=")
205
+ it 'should recognize a manually defined setter method' do
206
+ m = @objects.find('InchTest#manual_setter=')
206
207
  refute m.getter?
207
- assert m.setter?, "should be a setter"
208
+ assert m.setter?, 'should be a setter'
208
209
  refute m.has_doc?
209
210
  assert_equal 0, m.score
210
211
  end
211
212
 
212
- it "should recognize a getter in a manually defined getter/setter pair" do
213
- m = @objects.find("InchTest#manual_getset")
214
- assert m.getter?, "should be a getter"
213
+ it 'should recognize a getter in a manually defined getter/setter pair' do
214
+ m = @objects.find('InchTest#manual_getset')
215
+ assert m.getter?, 'should be a getter'
215
216
  refute m.setter?
216
217
  refute m.has_doc?
217
218
  assert_equal 0, m.score
218
219
  end
219
220
 
220
- it "should recognize a setter in a manually defined getter/setter pair" do
221
- m = @objects.find("InchTest#manual_getset=")
221
+ it 'should recognize a setter in a manually defined getter/setter pair' do
222
+ m = @objects.find('InchTest#manual_getset=')
222
223
  refute m.getter?
223
- assert m.setter?, "should be a setter"
224
+ assert m.setter?, 'should be a setter'
224
225
  refute m.has_doc?
225
226
  assert_equal 0, m.score
226
227
  end
227
228
 
228
- it "should recognize a getter in a getter/setter pair defined via" \
229
- " attr_accessor" do
230
- m = @objects.find("InchTest#attr_getset")
231
- assert m.getter?, "should be a getter"
229
+ it 'should recognize a getter in a getter/setter pair defined via' \
230
+ ' attr_accessor' do
231
+ m = @objects.find('InchTest#attr_getset')
232
+ assert m.getter?, 'should be a getter'
232
233
  refute m.setter?
233
234
  refute m.has_doc?
234
235
  assert_equal 0, m.score
235
236
  end
236
237
 
237
- it "should recognize a setter in a getter/setter pair defined via" \
238
- " attr_accessor" do
239
- m = @objects.find("InchTest#attr_getset=")
238
+ it 'should recognize a setter in a getter/setter pair defined via' \
239
+ ' attr_accessor' do
240
+ m = @objects.find('InchTest#attr_getset=')
240
241
  refute m.getter?
241
- assert m.setter?, "should be a setter"
242
+ assert m.setter?, 'should be a setter'
242
243
  refute m.has_doc?
243
244
  assert_equal 0, m.score
244
245
  end
245
246
 
246
- it "should recognize a getter in a getter/setter pair defined via Struct" do
247
- m = @objects.find("InchTest::StructGetSet#struct_getset")
248
- assert m.getter?, "should be a getter"
247
+ it 'should recognize a getter in a getter/setter pair defined via Struct' do
248
+ m = @objects.find('InchTest::StructGetSet#struct_getset')
249
+ assert m.getter?, 'should be a getter'
249
250
  refute m.setter?
250
251
  refute m.has_doc?
251
252
  assert_equal 0, m.score
252
253
  end
253
254
 
254
- it "should recognize a setter in a getter/setter pair defined via Struct" do
255
- m = @objects.find("InchTest::StructGetSet#struct_getset=")
255
+ it 'should recognize a setter in a getter/setter pair defined via Struct' do
256
+ m = @objects.find('InchTest::StructGetSet#struct_getset=')
256
257
  refute m.getter?
257
- assert m.setter?, "should be a setter"
258
+ assert m.setter?, 'should be a setter'
258
259
  refute m.has_doc?
259
260
  assert_equal 0, m.score
260
261
  end
261
262
 
262
- it "should recognize docs on a getter in a getter/setter pair defined via" \
263
- " attr_accessor" do
264
- m = @objects.find("Attributes#username")
263
+ it 'should recognize docs on a getter in a getter/setter pair defined via' \
264
+ ' attr_accessor' do
265
+ m = @objects.find('Attributes#username')
265
266
  refute_equal 0, m.score
266
267
  refute m.undocumented?
267
268
  end
268
269
 
269
- it "should recognize docs on a setter in a getter/setter pair defined via" \
270
- " attr_accessor" do
271
- m = @objects.find("Attributes#username=")
270
+ it 'should recognize docs on a setter in a getter/setter pair defined via' \
271
+ ' attr_accessor' do
272
+ m = @objects.find('Attributes#username=')
272
273
  refute_equal 0, m.score
273
274
  refute m.undocumented?
274
275
  end
275
276
 
276
- it "should recognize splat parameter notation" do
277
+ it 'should recognize splat parameter notation' do
277
278
  # it should assign the same score whether the parameter is
278
279
  # described with or without the splat (*) operator
279
- m1 = @objects.find("Foo#method_with_splat_parameter")
280
- m2 = @objects.find("Foo#method_with_splat_parameter2")
280
+ m1 = @objects.find('Foo#method_with_splat_parameter')
281
+ m2 = @objects.find('Foo#method_with_splat_parameter2')
281
282
  assert_equal 1, m1.parameters.size
282
283
  assert_equal 1, m2.parameters.size
283
284
  assert_equal m1.score, m2.score
284
285
  end
285
286
 
286
- it "should recognize alias methods and aliased methods" do
287
- m1 = @objects.find("InchTest#_aliased_method")
288
- m2 = @objects.find("InchTest#_alias_method")
287
+ it 'should recognize alias methods and aliased methods' do
288
+ m1 = @objects.find('InchTest#_aliased_method')
289
+ m2 = @objects.find('InchTest#_alias_method')
289
290
  assert_equal m1.score, m2.score
290
291
  end
291
292
  end
292
293
 
293
- describe "YARDs @!attribute directive on a class" do
294
+ describe 'YARDs @!attribute directive on a class' do
294
295
  #
295
- it "should work as a reader" do
296
- m = @objects.find("Attributes#email")
296
+ it 'should work as a reader' do
297
+ m = @objects.find('Attributes#email')
297
298
  refute_equal 0, m.score
298
299
  refute m.undocumented?
299
300
  end
300
301
 
301
- it "should work as a writer" do
302
- m = @objects.find("Attributes#email=")
302
+ it 'should work as a writer' do
303
+ m = @objects.find('Attributes#email=')
303
304
  refute_equal 0, m.score
304
305
  # refute m.undocumented?
305
306
  # NOTE: this is undocumented since there is no original_docstring
306
307
  end
307
308
  end
308
309
 
309
- describe "YARDs @overload tag on methods" do
310
+ describe 'YARDs @overload tag on methods' do
310
311
  #
311
- it "should work with basic overloading" do
312
+ it 'should work with basic overloading' do
312
313
  list = []
313
- list << @objects.find("Overloading#rgb")
314
- list << @objects.find("Overloading#rgba")
315
- list << @objects.find("Overloading#change_color")
316
- list << @objects.find("Overloading#mix")
317
- list << @objects.find("Overloading#hooks")
318
- list << @objects.find("Overloading#identifiers")
319
- list << @objects.find("Overloading#params_only_in_overloads")
314
+ list << @objects.find('Overloading#rgb')
315
+ list << @objects.find('Overloading#rgba')
316
+ list << @objects.find('Overloading#change_color')
317
+ list << @objects.find('Overloading#mix')
318
+ list << @objects.find('Overloading#hooks')
319
+ list << @objects.find('Overloading#identifiers')
320
+ list << @objects.find('Overloading#params_only_in_overloads')
320
321
  list.each do |m|
321
322
  assert_equal 100, m.score, "#{m.fullname} did not get 100"
322
323
  end
323
324
  end
324
325
 
325
- it "should work with a malformed @param tag in an overload tag" do
326
- m = @objects.find("Overloading#missing_param_names")
326
+ it 'should work with a malformed @param tag in an overload tag' do
327
+ m = @objects.find('Overloading#missing_param_names')
327
328
  refute m.has_doc? # it may be mentioned in the docs, but it's malformed.
328
329
  end
329
330
 
330
- it "should work with several overload tags on the same method" do
331
+ it 'should work with several overload tags on the same method' do
331
332
  skip
332
- m = @objects.find("Overloading#many_overloads")
333
+ m = @objects.find('Overloading#many_overloads')
333
334
  assert_equal 1, count_roles(
334
335
  m, Inch::Language::Ruby::Evaluation::Role::Method::WithoutReturnDescription)
335
336
  assert_equal 1, count_roles(
336
337
  m, Inch::Language::Ruby::Evaluation::Role::Method::WithoutReturnType)
337
338
  assert_equal 1, count_roles(
338
- m, Inch::Language::Ruby::Evaluation::Role::MethodParameter::WithoutMention, "block")
339
+ m, Inch::Language::Ruby::Evaluation::Role::MethodParameter::WithoutMention,
340
+ 'block')
339
341
  end
340
342
 
341
- it "should work if @param tags are only present in the @overload tags," \
342
- " but not on the actual method" do
343
- m = @objects.find("Overloading#params_only_in_overloads")
343
+ it 'should work if @param tags are only present in the @overload tags,' \
344
+ ' but not on the actual method' do
345
+ m = @objects.find('Overloading#params_only_in_overloads')
344
346
  unexpected_roles = [
345
347
  Inch::Language::Ruby::Evaluation::Role::Object::WithoutCodeExample,
346
348
  Inch::Language::Ruby::Evaluation::Role::MethodParameter::WithoutMention,
@@ -349,8 +351,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
349
351
  assert_roles m, [], unexpected_roles
350
352
  end
351
353
 
352
- it "should work with one param missing in the overload tag" do
353
- m = @objects.find("Overloading#one_param_missing_in_overload")
354
+ it 'should work with one param missing in the overload tag' do
355
+ m = @objects.find('Overloading#one_param_missing_in_overload')
354
356
  unexpected_roles = [
355
357
  Inch::Language::Ruby::Evaluation::Role::Object::WithoutCodeExample
356
358
  ]
@@ -362,12 +364,12 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
362
364
  end
363
365
  end
364
366
 
365
- describe "MISC" do
367
+ describe 'MISC' do
366
368
  #
367
- it "should recognize named parameters in Ruby 2.1" do
369
+ it 'should recognize named parameters in Ruby 2.1' do
368
370
  skip # unless RUBY_VERSION =~ /^2/
369
371
 
370
- m = @objects.find("Foo#method_with_named_parameter")
372
+ m = @objects.find('Foo#method_with_named_parameter')
371
373
  unexpected_roles = [
372
374
  Inch::Language::Ruby::Evaluation::Role::MethodParameter::WithoutMention,
373
375
  Inch::Language::Ruby::Evaluation::Role::MethodParameter::WithoutType
@@ -375,10 +377,10 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
375
377
  assert_roles m, [], unexpected_roles
376
378
  end
377
379
 
378
- it "should recognize indented parameter documentation" do
380
+ it 'should recognize indented parameter documentation' do
379
381
  skip # YARD cannot parse this
380
382
 
381
- m = @objects.find("Foo#method_with_indented_param_tag")
383
+ m = @objects.find('Foo#method_with_indented_param_tag')
382
384
  unexpected_roles = [
383
385
  Inch::Language::Ruby::Evaluation::Role::MethodParameter::WithoutMention,
384
386
  Inch::Language::Ruby::Evaluation::Role::MethodParameter::WithoutType
@@ -386,8 +388,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
386
388
  assert_roles m, [], unexpected_roles
387
389
  end
388
390
 
389
- it "should recognize wrong parameter documentation" do
390
- m = @objects.find("Foo::Bar#method_with_wrong_doc")
391
+ it 'should recognize wrong parameter documentation' do
392
+ m = @objects.find('Foo::Bar#method_with_wrong_doc')
391
393
  assert m.has_doc?
392
394
  assert m.has_parameters?
393
395
  assert m.return_mentioned?
@@ -410,8 +412,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
410
412
  assert m.score
411
413
  end
412
414
 
413
- it "should recognize fully-documented methods with parameters" do
414
- m = @objects.find("Foo::Bar#method_with_full_doc")
415
+ it 'should recognize fully-documented methods with parameters' do
416
+ m = @objects.find('Foo::Bar#method_with_full_doc')
415
417
  assert m.has_doc?
416
418
  assert m.has_parameters?
417
419
  assert m.return_mentioned?
@@ -427,8 +429,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
427
429
  assert_equal 100, m.score
428
430
  end
429
431
 
430
- it "should recognize question mark methods" do
431
- m = @objects.find("InchTest#question_mark_method?")
432
+ it 'should recognize question mark methods' do
433
+ m = @objects.find('InchTest#question_mark_method?')
432
434
  refute m.has_doc?
433
435
  refute m.has_parameters?
434
436
 
@@ -436,8 +438,8 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
436
438
  assert_equal 0, m.score
437
439
  end
438
440
 
439
- it "should recognize question mark methods with description" do
440
- m = @objects.find("InchTest#question_mark_method_with_description?")
441
+ it 'should recognize question mark methods with description' do
442
+ m = @objects.find('InchTest#question_mark_method_with_description?')
441
443
  refute m.has_doc?
442
444
  refute m.has_parameters?
443
445
 
@@ -445,26 +447,26 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
445
447
  assert m.score >= 50 # TODO: don't use magic numbers
446
448
  end
447
449
 
448
- it "should recognize question mark methods with description and" \
449
- " parameters" do
450
- m = @objects.find("InchTest#method_with_description_and_parameters?")
450
+ it 'should recognize question mark methods with description and' \
451
+ ' parameters' do
452
+ m = @objects.find('InchTest#method_with_description_and_parameters?')
451
453
  refute m.has_doc?
452
454
  assert m.has_parameters?
453
455
 
454
456
  assert m.score > 0
455
457
  end
456
458
 
457
- it "should recognize the depth of methods" do
458
- m = @objects.find("#root_method")
459
+ it 'should recognize the depth of methods' do
460
+ m = @objects.find('#root_method')
459
461
  assert_equal 1, m.depth
460
- m = @objects.find("InchTest#getter")
462
+ m = @objects.find('InchTest#getter')
461
463
  assert_equal 2, m.depth
462
- m = @objects.find("Foo::Bar#method_without_doc")
464
+ m = @objects.find('Foo::Bar#method_without_doc')
463
465
  assert_equal 3, m.depth
464
466
  end
465
467
 
466
- it "should recognize docs on class variables" do
467
- m = @objects.find("Foo::@@class_variable")
468
+ it 'should recognize docs on class variables' do
469
+ m = @objects.find('Foo::@@class_variable')
468
470
  assert m.has_doc?
469
471
  refute m.undocumented?
470
472
  assert_equal 100, m.score