inch 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +15 -0
  3. data/.rubocop_todo.yml +113 -0
  4. data/CHANGELOG.md +6 -0
  5. data/Gemfile +5 -2
  6. data/README.md +2 -2
  7. data/Rakefile +2 -2
  8. data/bin/inch +3 -2
  9. data/config/defaults.rb +7 -0
  10. data/inch.gemspec +7 -7
  11. data/lib/inch.rb +9 -10
  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 +2 -3
  15. data/lib/inch/api/compare/codebases.rb +1 -1
  16. data/lib/inch/api/diff.rb +6 -9
  17. data/lib/inch/api/options/base.rb +4 -4
  18. data/lib/inch/api/options/suggest.rb +1 -1
  19. data/lib/inch/api/stats.rb +0 -1
  20. data/lib/inch/api/suggest.rb +8 -9
  21. data/lib/inch/cli.rb +6 -6
  22. data/lib/inch/cli/command.rb +15 -15
  23. data/lib/inch/cli/command/base.rb +2 -2
  24. data/lib/inch/cli/command/console.rb +5 -5
  25. data/lib/inch/cli/command/diff.rb +7 -8
  26. data/lib/inch/cli/command/inspect.rb +5 -4
  27. data/lib/inch/cli/command/list.rb +4 -4
  28. data/lib/inch/cli/command/options/base.rb +8 -8
  29. data/lib/inch/cli/command/options/base_list.rb +9 -5
  30. data/lib/inch/cli/command/options/console.rb +4 -3
  31. data/lib/inch/cli/command/options/diff.rb +6 -4
  32. data/lib/inch/cli/command/options/inspect.rb +2 -2
  33. data/lib/inch/cli/command/options/list.rb +4 -3
  34. data/lib/inch/cli/command/options/show.rb +2 -2
  35. data/lib/inch/cli/command/options/stats.rb +2 -1
  36. data/lib/inch/cli/command/options/suggest.rb +6 -3
  37. data/lib/inch/cli/command/output/base.rb +2 -4
  38. data/lib/inch/cli/command/output/console.rb +4 -5
  39. data/lib/inch/cli/command/output/diff.rb +6 -6
  40. data/lib/inch/cli/command/output/inspect.rb +6 -8
  41. data/lib/inch/cli/command/output/list.rb +0 -1
  42. data/lib/inch/cli/command/output/show.rb +4 -5
  43. data/lib/inch/cli/command/output/stats.rb +21 -21
  44. data/lib/inch/cli/command/output/suggest.rb +28 -26
  45. data/lib/inch/cli/command/show.rb +4 -4
  46. data/lib/inch/cli/command/stats.rb +4 -4
  47. data/lib/inch/cli/command/suggest.rb +6 -6
  48. data/lib/inch/cli/command_parser.rb +6 -5
  49. data/lib/inch/cli/sparkline_helper.rb +2 -2
  50. data/lib/inch/cli/trace_helper.rb +1 -1
  51. data/lib/inch/cli/yardopts_helper.rb +4 -3
  52. data/lib/inch/code_object.rb +3 -3
  53. data/lib/inch/code_object/converter.rb +6 -8
  54. data/lib/inch/code_object/provider.rb +1 -1
  55. data/lib/inch/code_object/provider/yard.rb +10 -12
  56. data/lib/inch/code_object/provider/yard/docstring.rb +53 -21
  57. data/lib/inch/code_object/provider/yard/nodoc_helper.rb +3 -3
  58. data/lib/inch/code_object/provider/yard/object.rb +11 -9
  59. data/lib/inch/code_object/provider/yard/object/base.rb +33 -9
  60. data/lib/inch/code_object/provider/yard/object/class_variable_object.rb +12 -0
  61. data/lib/inch/code_object/provider/yard/object/method_object.rb +36 -11
  62. data/lib/inch/code_object/provider/yard/object/method_parameter_object.rb +2 -2
  63. data/lib/inch/code_object/provider/yard/object/method_signature.rb +11 -8
  64. data/lib/inch/code_object/provider/yard/object/namespace_object.rb +1 -4
  65. data/lib/inch/code_object/provider/yard/parser.rb +2 -2
  66. data/lib/inch/code_object/proxy.rb +10 -9
  67. data/lib/inch/code_object/proxy/base.rb +8 -8
  68. data/lib/inch/code_object/proxy/class_variable_object.rb +8 -0
  69. data/lib/inch/code_object/proxy/method_object.rb +3 -2
  70. data/lib/inch/code_object/proxy/method_parameter_object.rb +1 -1
  71. data/lib/inch/codebase.rb +4 -5
  72. data/lib/inch/codebase/objects_filter.rb +2 -4
  73. data/lib/inch/codebase/serializer.rb +3 -3
  74. data/lib/inch/config.rb +2 -2
  75. data/lib/inch/config/base.rb +0 -1
  76. data/lib/inch/config/codebase.rb +3 -3
  77. data/lib/inch/core_ext.rb +1 -1
  78. data/lib/inch/core_ext/string.rb +1 -1
  79. data/lib/inch/evaluation.rb +16 -15
  80. data/lib/inch/evaluation/grade_list.rb +2 -2
  81. data/lib/inch/evaluation/object_schema.rb +1 -1
  82. data/lib/inch/evaluation/proxy.rb +8 -7
  83. data/lib/inch/evaluation/proxy/base.rb +12 -7
  84. data/lib/inch/evaluation/proxy/class_variable_object.rb +19 -0
  85. data/lib/inch/evaluation/proxy/constant_object.rb +1 -1
  86. data/lib/inch/evaluation/proxy/method_object.rb +12 -5
  87. data/lib/inch/evaluation/proxy/module_object.rb +1 -1
  88. data/lib/inch/evaluation/proxy/namespace_object.rb +1 -1
  89. data/lib/inch/evaluation/role/base.rb +1 -1
  90. data/lib/inch/evaluation/role/class_variable.rb +55 -0
  91. data/lib/inch/evaluation/role/method.rb +0 -1
  92. data/lib/inch/evaluation/role/method_parameter.rb +2 -1
  93. data/lib/inch/evaluation/role/object.rb +2 -2
  94. data/lib/inch/rake.rb +2 -2
  95. data/lib/inch/rake/suggest.rb +2 -2
  96. data/lib/inch/utils/shell_helper.rb +1 -1
  97. data/lib/inch/utils/ui.rb +5 -5
  98. data/lib/inch/utils/weighted_list.rb +2 -3
  99. data/lib/inch/version.rb +1 -1
  100. data/test/fixtures/simple/lib/broken.rb +35 -7
  101. data/test/fixtures/simple/lib/broken_ruby_2_0_features.rb +7 -0
  102. data/test/fixtures/simple/lib/directives.rb +8 -0
  103. data/test/fixtures/simple/lib/foo.rb +17 -0
  104. data/test/integration/api/compare/codebases.rb +1 -1
  105. data/test/integration/cli/command/console_test.rb +5 -5
  106. data/test/integration/cli/command/inspect_test.rb +4 -5
  107. data/test/integration/cli/command/list_test.rb +3 -4
  108. data/test/integration/cli/command/show_test.rb +4 -4
  109. data/test/integration/cli/command/stats_test.rb +2 -2
  110. data/test/integration/cli/command/suggest_test.rb +7 -7
  111. data/test/integration/stats_options_test.rb +3 -3
  112. data/test/integration/visibility_options_test.rb +13 -13
  113. data/test/shared/base_list.rb +4 -3
  114. data/test/test_helper.rb +16 -5
  115. data/test/unit/api/filter_test.rb +7 -7
  116. data/test/unit/api/get_test.rb +1 -1
  117. data/test/unit/api/list_test.rb +1 -1
  118. data/test/unit/api/options/base_test.rb +3 -3
  119. data/test/unit/api/stats_test.rb +1 -1
  120. data/test/unit/api/suggest_test.rb +3 -3
  121. data/test/unit/cli/arguments_test.rb +1 -1
  122. data/test/unit/cli/command/base_test.rb +1 -1
  123. data/test/unit/cli/command/options/base_list_test.rb +2 -2
  124. data/test/unit/cli/command/options/base_object_test.rb +1 -1
  125. data/test/unit/cli/command/options/base_test.rb +1 -1
  126. data/test/unit/cli/command_parser_test.rb +2 -2
  127. data/test/unit/cli/trace_helper_test.rb +1 -1
  128. data/test/unit/cli/yardopts_helper_test.rb +4 -3
  129. data/test/unit/code_object/converter_test.rb +1 -1
  130. data/test/unit/code_object/provider/yard/docstring_test.rb +105 -28
  131. data/test/unit/code_object/provider/yard/nodoc_helper_test.rb +5 -5
  132. data/test/unit/code_object/provider/yard/object/method_object_test.rb +20 -10
  133. data/test/unit/code_object/provider/yard_test.rb +4 -4
  134. data/test/unit/code_object/provider_test.rb +1 -1
  135. data/test/unit/code_object/proxy/method_object_test.rb +366 -262
  136. data/test/unit/code_object/proxy_test.rb +1 -1
  137. data/test/unit/codebase/objects_test.rb +2 -2
  138. data/test/unit/codebase/proxy_test.rb +1 -1
  139. data/test/unit/config/codebase_test.rb +1 -1
  140. data/test/unit/evaluation/role/base_test.rb +1 -1
  141. data/test/unit/utils/ui_test.rb +4 -4
  142. data/test/unit/utils/weighted_list_test.rb +7 -4
  143. metadata +12 -2
@@ -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
  describe ::Inch::CodeObject::Proxy::Base do
4
4
  before do
@@ -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
  describe ::Inch::Codebase::Objects do
4
4
  before do
@@ -18,7 +18,7 @@ describe ::Inch::Codebase::Objects do
18
18
 
19
19
  it "should support iteration" do
20
20
  sum = 0
21
- @objects.each do |o|
21
+ @objects.each do
22
22
  sum += 1
23
23
  end
24
24
  assert_equal @objects.size, sum
@@ -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
  describe ::Inch::Codebase::Proxy do
4
4
  it "should parse all objects" do
@@ -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
  describe ::Inch::Config::Codebase do
4
4
  it "should parse .inch.yml" do
@@ -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::Base
4
4
  applicable_if :private?
@@ -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
  describe ::Inch::Utils::UI do
4
4
  it "should trace" do
@@ -20,18 +20,18 @@ describe ::Inch::Utils::UI do
20
20
  end
21
21
 
22
22
  it "should trace debug if ENV variable is set" do
23
- ENV['DEBUG'] = "1"
23
+ ENV["DEBUG"] = "1"
24
24
  out, err = capture_io do
25
25
  @instance = ::Inch::Utils::UI.new
26
26
  @instance.debug("Test")
27
27
  end
28
- ENV['DEBUG'] = nil
28
+ ENV["DEBUG"] = nil
29
29
  refute out.empty?, "there should be no output"
30
30
  assert err.empty?, "there should be no errors"
31
31
  end
32
32
 
33
33
  it "should not trace debug if ENV variable is set" do
34
- refute ENV['DEBUG']
34
+ refute ENV["DEBUG"]
35
35
  out, err = capture_io do
36
36
  @instance = ::Inch::Utils::UI.new
37
37
  @instance.debug("Test")
@@ -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
  describe ::Inch::Utils::WeightedList do
4
4
  before do
@@ -7,8 +7,11 @@ describe ::Inch::Utils::WeightedList do
7
7
 
8
8
  def assert_weighted_list(list, counts, expected)
9
9
  weighted_list = ::Inch::Utils::WeightedList.new(list, counts)
10
- # assert_equal expected.map(&:size).inject(:+), weighted_list.to_a.map(&:size).inject(:+)
11
- assert_equal expected, weighted_list.to_a, "should be #{expected.map(&:size)}, was #{weighted_list.to_a.map(&:size)}"
10
+ # assert_equal expected.map(&:size).inject(:+),
11
+ # weighted_list.to_a.map(&:size).inject(:+)
12
+ assert_equal expected, weighted_list.to_a,
13
+ "should be #{expected.map(&:size)}, was " \
14
+ "#{weighted_list.to_a.map(&:size)}"
12
15
  end
13
16
 
14
17
  def list_and_expected(counts, expected_counts)
@@ -19,7 +22,7 @@ describe ::Inch::Utils::WeightedList do
19
22
  expected = expected_counts.map.with_index do |num, index|
20
23
  (1..num).map { |i| :"#{elements[index]}#{i}" }
21
24
  end
22
- return list, expected
25
+ [list, expected]
23
26
  end
24
27
 
25
28
  it "should work if elements are exact" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - René Föhring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-14 00:00:00.000000000 Z
11
+ date: 2014-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -117,6 +117,8 @@ extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
119
  - ".gitignore"
120
+ - ".rubocop.yml"
121
+ - ".rubocop_todo.yml"
120
122
  - ".ruby-gemset"
121
123
  - ".ruby-version"
122
124
  - ".simplecov"
@@ -189,6 +191,7 @@ files:
189
191
  - lib/inch/code_object/provider/yard/object.rb
190
192
  - lib/inch/code_object/provider/yard/object/base.rb
191
193
  - lib/inch/code_object/provider/yard/object/class_object.rb
194
+ - lib/inch/code_object/provider/yard/object/class_variable_object.rb
192
195
  - lib/inch/code_object/provider/yard/object/constant_object.rb
193
196
  - lib/inch/code_object/provider/yard/object/method_object.rb
194
197
  - lib/inch/code_object/provider/yard/object/method_parameter_object.rb
@@ -200,6 +203,7 @@ files:
200
203
  - lib/inch/code_object/proxy.rb
201
204
  - lib/inch/code_object/proxy/base.rb
202
205
  - lib/inch/code_object/proxy/class_object.rb
206
+ - lib/inch/code_object/proxy/class_variable_object.rb
203
207
  - lib/inch/code_object/proxy/constant_object.rb
204
208
  - lib/inch/code_object/proxy/method_object.rb
205
209
  - lib/inch/code_object/proxy/method_parameter_object.rb
@@ -224,11 +228,13 @@ files:
224
228
  - lib/inch/evaluation/proxy.rb
225
229
  - lib/inch/evaluation/proxy/base.rb
226
230
  - lib/inch/evaluation/proxy/class_object.rb
231
+ - lib/inch/evaluation/proxy/class_variable_object.rb
227
232
  - lib/inch/evaluation/proxy/constant_object.rb
228
233
  - lib/inch/evaluation/proxy/method_object.rb
229
234
  - lib/inch/evaluation/proxy/module_object.rb
230
235
  - lib/inch/evaluation/proxy/namespace_object.rb
231
236
  - lib/inch/evaluation/role/base.rb
237
+ - lib/inch/evaluation/role/class_variable.rb
232
238
  - lib/inch/evaluation/role/constant.rb
233
239
  - lib/inch/evaluation/role/method.rb
234
240
  - lib/inch/evaluation/role/method_parameter.rb
@@ -254,6 +260,8 @@ files:
254
260
  - test/fixtures/really_good_pedantic/lib/foo.rb
255
261
  - test/fixtures/simple/README
256
262
  - test/fixtures/simple/lib/broken.rb
263
+ - test/fixtures/simple/lib/broken_ruby_2_0_features.rb
264
+ - test/fixtures/simple/lib/directives.rb
257
265
  - test/fixtures/simple/lib/foo.rb
258
266
  - test/fixtures/simple/lib/nodoc.rb
259
267
  - test/fixtures/simple/lib/role_methods.rb
@@ -337,6 +345,8 @@ test_files:
337
345
  - test/fixtures/really_good_pedantic/lib/foo.rb
338
346
  - test/fixtures/simple/README
339
347
  - test/fixtures/simple/lib/broken.rb
348
+ - test/fixtures/simple/lib/broken_ruby_2_0_features.rb
349
+ - test/fixtures/simple/lib/directives.rb
340
350
  - test/fixtures/simple/lib/foo.rb
341
351
  - test/fixtures/simple/lib/nodoc.rb
342
352
  - test/fixtures/simple/lib/role_methods.rb