inch 0.7.1 → 0.8.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/CHANGELOG.md +5 -0
  4. data/README.md +2 -2
  5. data/Rakefile +5 -0
  6. data/config/base.rb +2 -2
  7. data/inch.gemspec +1 -1
  8. data/lib/inch/cli/command/options/base.rb +2 -2
  9. data/lib/inch/cli/command/output/base.rb +1 -1
  10. data/lib/inch/cli/command/output/diff.rb +3 -3
  11. data/lib/inch/cli/command/output/inspect.rb +5 -5
  12. data/lib/inch/cli/command/output/list.rb +3 -3
  13. data/lib/inch/cli/command/output/show.rb +1 -1
  14. data/lib/inch/cli/command/output/stats.rb +1 -1
  15. data/lib/inch/cli/command/output/suggest.rb +1 -1
  16. data/lib/inch/cli/command_parser.rb +6 -1
  17. data/lib/inch/core_ext/string.rb +13 -1
  18. data/lib/inch/language/elixir/roles/function.rb +6 -6
  19. data/lib/inch/language/elixir/roles/function_parameter.rb +4 -4
  20. data/lib/inch/language/elixir/roles/object.rb +4 -4
  21. data/lib/inch/language/javascript/roles/function.rb +6 -6
  22. data/lib/inch/language/javascript/roles/function_parameter.rb +4 -4
  23. data/lib/inch/language/javascript/roles/object.rb +6 -6
  24. data/lib/inch/language/ruby/provider/yard/object/base.rb +0 -4
  25. data/lib/inch/language/ruby/roles/class_variable.rb +2 -2
  26. data/lib/inch/language/ruby/roles/constant.rb +2 -2
  27. data/lib/inch/language/ruby/roles/method.rb +6 -6
  28. data/lib/inch/language/ruby/roles/method_parameter.rb +4 -4
  29. data/lib/inch/language/ruby/roles/object.rb +9 -9
  30. data/lib/inch/utils/ui.rb +1 -1
  31. data/lib/inch/version.rb +1 -1
  32. data/test/integration/cli/command/console_test.rb +1 -1
  33. data/test/integration/cli/command/stats_test.rb +2 -2
  34. data/test/unit/code_object/proxy_test.rb +3 -3
  35. data/test/unit/config_test.rb +1 -1
  36. data/test/unit/language/ruby/code_object/method_object_test.rb +1 -0
  37. metadata +7 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40896e039aaa1bfed752dc6d80b2df28e5e628e6
4
- data.tar.gz: cdac11d21c63a5e3e86ae5d8194f43e8f5a44a85
3
+ metadata.gz: 52049e432e0060e9957dcb446607e00135ddc66b
4
+ data.tar.gz: d3b7e49b5ea554c8a6e9060b397e2917f4643f7f
5
5
  SHA512:
6
- metadata.gz: 61f6c799bafcbd6f2251712c7206ed7f1e24431af34d704b9e656cd31e73d46b7364577ff1b5380be36960b7b5c25ffb76705156012ced4d5c4f9b6888b96ce1
7
- data.tar.gz: 9cad52e8dc6ebede402102cfe23a9b90f71c2e19229c7176126116bbb9e1b2c6f945a7b54b0e2a6a030bbdfab2f9c2db1a1822c0e0d8282fc64f56dd2bbf52f3
6
+ metadata.gz: 4ca6ea886603309b41cb22103cf6f5adaf73624aa3f55311c5939c908c6e426e0fd8d3b9714c409813773206ed42b073dc3870e9f3e0e058b6b569a055397ccf
7
+ data.tar.gz: 4074223078bbc9d2b26a6476b156adda1c4d57ecd35e8037516caa09ea9a3efceb8e41c83aa58561a2011c439f1940e1538ba388273c5ef35ce9866d970f2bb7
@@ -5,6 +5,8 @@ rvm:
5
5
  - 2.0
6
6
  - 2.1
7
7
  - 2.2
8
+ - 2.3
9
+ - 2.4
8
10
  - ruby-head
9
11
  - jruby-head
10
12
  - jruby-19mode
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0
4
+
5
+ - CLI: Do not include `Term::ANSIColor` into `String`
6
+ - Ruby: Use newer version of YARD
7
+
3
8
  ## 0.7.1
4
9
 
5
10
  - Ruby: Setters can now be documented via their @param or @return
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Inch [![Build Status](https://travis-ci.org/rrrene/inch.png)](https://travis-ci.org/rrrene/inch) [![Code Climate](https://codeclimate.com/github/rrrene/inch.svg)](https://codeclimate.com/github/rrrene/inch) [![Inline docs](http://inch-ci.org/github/rrrene/inch.svg)](http://inch-ci.org/github/rrrene/inch)
1
+ # Inch [![Build Status](https://travis-ci.org/rrrene/inch.svg?branch=master)](https://travis-ci.org/rrrene/inch) [![Code Climate](https://codeclimate.com/github/rrrene/inch.svg)](https://codeclimate.com/github/rrrene/inch) [![Inline docs](http://inch-ci.org/github/rrrene/inch.svg)](http://inch-ci.org/github/rrrene/inch)
2
2
 
3
3
  `inch` gives you hints where to improve your docs. One Inch at a time.
4
4
 
@@ -190,7 +190,7 @@ The grade distribution does a much better job of painting the bigger picture.
190
190
 
191
191
  ## Features
192
192
 
193
- Inch is build to parse [YARD](http://yardoc.org/),
193
+ Inch is built to parse [YARD](http://yardoc.org/),
194
194
  [RDoc](http://rdoc.rubyforge.org/) and [TomDoc](http://tomdoc.org/)
195
195
  style documentation comments, but works reasonably well with unstructured
196
196
  comments.
data/Rakefile CHANGED
@@ -4,22 +4,27 @@ require 'rake/testtask'
4
4
 
5
5
  Rake::TestTask.new do |t|
6
6
  t.pattern = 'test/**/*_test.rb'
7
+ t.warning = false
7
8
  end
8
9
 
9
10
  Rake::TestTask.new(:"test:unit") do |t|
10
11
  t.pattern = 'test/unit/**/*_test.rb'
12
+ t.warning = false
11
13
  end
12
14
 
13
15
  Rake::TestTask.new(:"test:elixir") do |t|
14
16
  t.pattern = 'test/unit/language/elixir/**/*_test.rb'
17
+ t.warning = false
15
18
  end
16
19
 
17
20
  Rake::TestTask.new(:"test:ruby") do |t|
18
21
  t.pattern = 'test/unit/language/ruby/**/*_test.rb'
22
+ t.warning = false
19
23
  end
20
24
 
21
25
  Rake::TestTask.new(:"test:integration") do |t|
22
26
  t.pattern = 'test/integration/**/*_test.rb'
27
+ t.warning = false
23
28
  end
24
29
 
25
30
  task default: :test
@@ -41,12 +41,12 @@ Inch::Config.base do
41
41
  end
42
42
 
43
43
  priority(:SE) do
44
- priorities -2...0
44
+ priorities (-2...0)
45
45
  arrow "\u2198"
46
46
  end
47
47
 
48
48
  priority(:S) do
49
- priorities -99...-2
49
+ priorities (-99...-2)
50
50
  arrow "\u2193"
51
51
  end
52
52
  end
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency 'pry'
26
26
  spec.add_dependency 'sparkr', '>= 0.2.0'
27
27
  spec.add_dependency 'term-ansicolor'
28
- spec.add_dependency 'yard', '~> 0.8.7.5'
28
+ spec.add_dependency 'yard', '~> 0.9.12'
29
29
  end
@@ -149,7 +149,7 @@ module Inch
149
149
  # @return [void]
150
150
  def kill(msg = nil)
151
151
  ui.warn usage
152
- ui.warn msg.red unless msg.nil?
152
+ ui.warn msg.color(:red) unless msg.nil?
153
153
  ui.warn "Try `--help' for more information."
154
154
  exit 1
155
155
  end
@@ -178,7 +178,7 @@ module Inch
178
178
  # @param [OptionParser::ParseError] err the exception raised by the
179
179
  # option parser
180
180
  def unrecognized_option(err)
181
- ui.warn "Unrecognized/#{err.message}".red
181
+ ui.warn "Unrecognized/#{err.message}".color(:red)
182
182
  end
183
183
  end
184
184
  end
@@ -28,7 +28,7 @@ module Inch
28
28
 
29
29
  def priority_arrow(priority, color = :white)
30
30
  Evaluation::PriorityRange.all.each do |range|
31
- return range.arrow.color(color).dark if range.include?(priority)
31
+ return range.arrow.color(color).color(:dark) if range.include?(priority)
32
32
  end
33
33
  end
34
34
 
@@ -60,19 +60,19 @@ module Inch
60
60
  ui.trace rev_hint
61
61
  ui.trace
62
62
  ui.trace 'Format: grade (before -> after), priority, and name. ' \
63
- "Try `--help' for options.".dark
63
+ "Try `--help' for options.".color(:dark)
64
64
  end
65
65
 
66
66
  def puts_added(o)
67
67
  grade = colored_grade(o)
68
- change = ' + '.dark + grade + ' ' + priority_arrow(o.priority)
68
+ change = ' + '.color(:dark) + grade + ' ' + priority_arrow(o.priority)
69
69
  ui.sub(" #{change} #{o.fullname}")
70
70
  end
71
71
 
72
72
  def puts_improved(before, o)
73
73
  before_grade = colored_grade(before)
74
74
  grade = colored_grade(o)
75
- change = before_grade + ' -> '.dark + grade + ' ' +
75
+ change = before_grade + ' -> '.color(:dark) + grade + ' ' +
76
76
  priority_arrow(o.priority)
77
77
  ui.sub(" #{change} #{o.fullname}")
78
78
  end
@@ -56,7 +56,7 @@ module Inch
56
56
 
57
57
  def print_roles_info(o)
58
58
  if o.roles.empty?
59
- echo 'No roles assigned.'.dark
59
+ echo 'No roles assigned.'.color(:dark)
60
60
  else
61
61
  o.roles.each do |role|
62
62
  print_role_info(role)
@@ -70,7 +70,7 @@ module Inch
70
70
  score = colored_role_score(role)
71
71
 
72
72
  priority = role.priority.to_s.rjust(4)
73
- priority = priority.dark if role.priority == 0
73
+ priority = priority.color(:dark) if role.priority == 0
74
74
 
75
75
  echo name.ljust(40) + score + priority
76
76
  print_min_max_score(role)
@@ -96,7 +96,7 @@ module Inch
96
96
 
97
97
  def colored_role_score(role)
98
98
  if role.potential_score
99
- "(#{role.potential_score})".rjust(5).yellow.dark
99
+ "(#{role.potential_score})".rjust(5).color(:yellow).color(:dark)
100
100
  else
101
101
  value = role.score
102
102
  colored_score value, value.abs.to_s.rjust(4)
@@ -105,9 +105,9 @@ module Inch
105
105
 
106
106
  def colored_score(value, score)
107
107
  if value < 0
108
- ('-' + score).red
108
+ ('-' + score).color(:red)
109
109
  elsif value > 0
110
- ('+' + score).green
110
+ ('+' + score).color(:green)
111
111
  else
112
112
  ' ' + score
113
113
  end
@@ -31,8 +31,8 @@ module Inch
31
31
 
32
32
  if @omitted > 0
33
33
  ui.trace
34
- ui.trace "This output omitted #{@omitted} objects. ".dark +
35
- 'Use `--all` to display all objects.'.dark
34
+ ui.trace "This output omitted #{@omitted} objects. ".color(:dark) +
35
+ 'Use `--all` to display all objects.'.color(:dark)
36
36
  end
37
37
  end
38
38
 
@@ -50,7 +50,7 @@ module Inch
50
50
  omitted = range.objects.size - display_count
51
51
  if omitted > 0
52
52
  @omitted += omitted
53
- echo range.color, "... (omitting #{omitted} objects)".dark
53
+ echo range.color, "... (omitting #{omitted} objects)".color(:dark)
54
54
  end
55
55
  end
56
56
 
@@ -40,7 +40,7 @@ module Inch
40
40
 
41
41
  def print_roles_info(o)
42
42
  if o.roles.empty?
43
- echo 'No roles assigned.'.dark
43
+ echo 'No roles assigned.'.color(:dark)
44
44
  else
45
45
  o.roles.each do |role|
46
46
  next unless role.suggestion
@@ -31,7 +31,7 @@ module Inch
31
31
  print_grades_by_priority
32
32
  print_priorities
33
33
  ui.trace
34
- ui.trace 'Try `--format json|yaml` for raw numbers.'.dark
34
+ ui.trace 'Try `--format json|yaml` for raw numbers.'.color(:dark)
35
35
  end
36
36
 
37
37
  def print_grades
@@ -60,7 +60,7 @@ module Inch
60
60
  else
61
61
  "Only considering priority objects: #{arrows}"
62
62
  end
63
- "#{pretext} (use `--help` for options).".dark
63
+ "#{pretext} (use `--help` for options).".color(:dark)
64
64
  end
65
65
 
66
66
  def display_files
@@ -34,6 +34,11 @@ module Inch
34
34
  class CommandParser
35
35
  include TraceHelper
36
36
 
37
+ # Represents a fake command, i.e. `--help` for use in the CLI.
38
+ #
39
+ # @api private
40
+ FakeCommand = Struct.new(:exit_status)
41
+
37
42
  class << self
38
43
  # @return [Hash{Symbol => Command}] the mapping of command names to
39
44
  # command classes to parse the user command.
@@ -77,7 +82,7 @@ module Inch
77
82
  command = commands[command_name].new
78
83
  ui.trace format(' %-8s %s', command_name, command.description)
79
84
  end
80
- exit 0
85
+ FakeCommand.new(0)
81
86
  end
82
87
 
83
88
  # Runs the {Command} object matching the command name of the first
@@ -1,3 +1,15 @@
1
1
  require 'term/ansicolor'
2
2
 
3
- String.send(:include, Term::ANSIColor)
3
+ module Inch
4
+ module StringExt
5
+ def color(color_name)
6
+ Term::ANSIColor.color(color_name, self)
7
+ end
8
+
9
+ def on_color(color_name)
10
+ Term::ANSIColor.on_color(color_name, self)
11
+ end
12
+ end
13
+ end
14
+
15
+ String.send(:include, Inch::StringExt)
@@ -14,7 +14,7 @@ module Inch
14
14
  # @see CodeObject::Ruby::MethodObject#has_many_parameters?
15
15
  class WithManyParameters < Base
16
16
  applicable_if :has_many_parameters?
17
- priority +2
17
+ priority(2)
18
18
  end
19
19
 
20
20
  # Role assigned to methods where the return value is typed in the
@@ -52,25 +52,25 @@ module Inch
52
52
  # @see CodeObject::Ruby::MethodObject#has_many_lines?
53
53
  class WithManyLines < Base
54
54
  applicable_if :has_many_lines?
55
- priority +2
55
+ priority(2)
56
56
  end
57
57
 
58
58
  # Role assigned to methods whose name end in a '!'
59
59
  class WithBangName < Base
60
60
  applicable_if :bang_name?
61
- priority +3
61
+ priority(3)
62
62
  end
63
63
 
64
64
  # Role assigned to methods whose name end in a '?'
65
65
  class WithQuestioningName < Base
66
66
  applicable_if :questioning_name?
67
- priority -4
67
+ priority(-4)
68
68
  end
69
69
 
70
70
  # Role assigned to methods which are aliased
71
71
  class HasAlias < Base
72
72
  applicable_if :has_alias?
73
- priority +2
73
+ priority(2)
74
74
  end
75
75
 
76
76
  # Role assigned to methods that are constructors
@@ -93,7 +93,7 @@ module Inch
93
93
  applicable_if :overridden?
94
94
  # It seems more important to document the overridden method,
95
95
  # than the overriding one
96
- priority -2
96
+ priority(-2)
97
97
 
98
98
  # This role doesnot assign a score.
99
99
  def score
@@ -49,7 +49,7 @@ module Inch
49
49
  # @see CodeObject::Ruby::MethodParameterObject#splat?
50
50
  class Splat < Base
51
51
  applicable_if :splat?
52
- priority +1
52
+ priority(1)
53
53
  end
54
54
 
55
55
  # Role assigned to parameters that are blocks, e.g. +&block+
@@ -57,7 +57,7 @@ module Inch
57
57
  # @see CodeObject::Ruby::MethodParameterObject#block?
58
58
  class Block < Base
59
59
  applicable_if :block?
60
- priority +1
60
+ priority(1)
61
61
  end
62
62
 
63
63
  # Role assigned to parameters that are documented, but not part of
@@ -66,7 +66,7 @@ module Inch
66
66
  # @see CodeObject::Ruby::MethodParameterObject#wrongly_mentioned?
67
67
  class WithWrongMention < Base
68
68
  applicable_if :wrongly_mentioned?
69
- priority +1
69
+ priority(1)
70
70
 
71
71
  def suggestion
72
72
  "The parameter '#{object.name}' seems not to be part of the " \
@@ -79,7 +79,7 @@ module Inch
79
79
  # @see CodeObject::Ruby::MethodParameterObject#bad_name?
80
80
  class WithBadName < Base
81
81
  applicable_if :bad_name?
82
- priority +1
82
+ priority(1)
83
83
  end
84
84
  end
85
85
  end
@@ -24,7 +24,7 @@ module Inch
24
24
  # the object seems undocumented to Inch.
25
25
  class Tagged < Base
26
26
  applicable_if :has_unconsidered_tags?
27
- priority -1
27
+ priority(-1)
28
28
  end
29
29
 
30
30
  # Role assigned to objects explicitly or implicitly tagged not to be
@@ -33,19 +33,19 @@ module Inch
33
33
  # @see CodeObject::NodocHelper
34
34
  class TaggedAsNodoc < Base
35
35
  applicable_if :nodoc?
36
- priority -7
36
+ priority(-7)
37
37
  end
38
38
 
39
39
  # Role assigned to objects declared in the top-level namespace
40
40
  class InRoot < Base
41
41
  applicable_if :in_root?
42
- priority +3
42
+ priority(3)
43
43
  end
44
44
 
45
45
  # Role assigned to public objects
46
46
  class Public < Base
47
47
  applicable_if :public?
48
- priority 0
48
+ priority(0)
49
49
  end
50
50
 
51
51
  # Role assigned to objects with a single code example
@@ -14,7 +14,7 @@ module Inch
14
14
  # @see CodeObject::Ruby::MethodObject#has_many_parameters?
15
15
  class WithManyParameters < Base
16
16
  applicable_if :has_many_parameters?
17
- priority +2
17
+ priority(2)
18
18
  end
19
19
 
20
20
  # Role assigned to methods where the return value is typed in the
@@ -52,25 +52,25 @@ module Inch
52
52
  # @see CodeObject::Ruby::MethodObject#has_many_lines?
53
53
  class WithManyLines < Base
54
54
  applicable_if :has_many_lines?
55
- priority +2
55
+ priority(2)
56
56
  end
57
57
 
58
58
  # Role assigned to methods whose name end in a '!'
59
59
  class WithBangName < Base
60
60
  applicable_if :bang_name?
61
- priority +3
61
+ priority(3)
62
62
  end
63
63
 
64
64
  # Role assigned to methods whose name end in a '?'
65
65
  class WithQuestioningName < Base
66
66
  applicable_if :questioning_name?
67
- priority -4
67
+ priority(-4)
68
68
  end
69
69
 
70
70
  # Role assigned to methods which are aliased
71
71
  class HasAlias < Base
72
72
  applicable_if :has_alias?
73
- priority +2
73
+ priority(2)
74
74
  end
75
75
 
76
76
  # Role assigned to methods that are constructors
@@ -93,7 +93,7 @@ module Inch
93
93
  applicable_if :overridden?
94
94
  # It seems more important to document the overridden method,
95
95
  # than the overriding one
96
- priority -2
96
+ priority(-2)
97
97
 
98
98
  # This role doesnot assign a score.
99
99
  def score
@@ -44,7 +44,7 @@ module Inch
44
44
  # @see CodeObject::Ruby::MethodParameterObject#splat?
45
45
  class Splat < Base
46
46
  applicable_if :splat?
47
- priority +1
47
+ priority(1)
48
48
  end
49
49
 
50
50
  # Role assigned to parameters that are blocks, e.g. +&block+
@@ -52,7 +52,7 @@ module Inch
52
52
  # @see CodeObject::Ruby::MethodParameterObject#block?
53
53
  class Block < Base
54
54
  applicable_if :block?
55
- priority +1
55
+ priority(1)
56
56
  end
57
57
 
58
58
  # Role assigned to parameters that are documented, but not part of
@@ -61,7 +61,7 @@ module Inch
61
61
  # @see CodeObject::Ruby::MethodParameterObject#wrongly_mentioned?
62
62
  class WithWrongMention < Base
63
63
  applicable_if :wrongly_mentioned?
64
- priority +1
64
+ priority(1)
65
65
 
66
66
  def suggestion
67
67
  "The parameter '#{object.name}' seems not to be part of the " \
@@ -74,7 +74,7 @@ module Inch
74
74
  # @see CodeObject::Ruby::MethodParameterObject#bad_name?
75
75
  class WithBadName < Base
76
76
  applicable_if :bad_name?
77
- priority +1
77
+ priority(1)
78
78
  end
79
79
  end
80
80
  end
@@ -24,7 +24,7 @@ module Inch
24
24
  # the object seems undocumented to Inch.
25
25
  class Tagged < Base
26
26
  applicable_if :has_unconsidered_tags?
27
- priority -1
27
+ priority(-1)
28
28
  end
29
29
 
30
30
  # Role assigned to objects explicitly or implicitly tagged not to be
@@ -33,31 +33,31 @@ module Inch
33
33
  # @see CodeObject::NodocHelper
34
34
  class TaggedAsNodoc < Base
35
35
  applicable_if :nodoc?
36
- priority -7
36
+ priority(-7)
37
37
  end
38
38
 
39
39
  # Role assigned to objects declared in the top-level namespace
40
40
  class InRoot < Base
41
41
  applicable_if :in_root?
42
- priority 0
42
+ priority(0)
43
43
  end
44
44
 
45
45
  # Role assigned to public objects
46
46
  class Public < Base
47
47
  applicable_if :public?
48
- priority 0
48
+ priority(0)
49
49
  end
50
50
 
51
51
  # Role assigned to protected objects
52
52
  class Protected < Base
53
53
  applicable_if :protected?
54
- priority -1
54
+ priority(-1)
55
55
  end
56
56
 
57
57
  # Role assigned to private objects
58
58
  class Private < Base
59
59
  applicable_if :private?
60
- priority -4
60
+ priority(-4)
61
61
  end
62
62
 
63
63
  # Role assigned to objects with a single code example
@@ -237,10 +237,6 @@ module Inch
237
237
  visibility == :public
238
238
  end
239
239
 
240
- def in_root?
241
- depth == 1
242
- end
243
-
244
240
  # @return [Boolean] +true+ if the object has no documentation at
245
241
  # all
246
242
  def undocumented?
@@ -21,11 +21,11 @@ module Inch
21
21
 
22
22
  class Public < Object::Public
23
23
  applicable_if :public?
24
- priority -1
24
+ priority(-1)
25
25
  end
26
26
  class Private < Object::Private
27
27
  applicable_if :private?
28
- priority -3
28
+ priority(-3)
29
29
  end
30
30
 
31
31
  class WithCodeExample < Object::WithCodeExample
@@ -21,11 +21,11 @@ module Inch
21
21
 
22
22
  class Public < Object::Public
23
23
  applicable_if :public?
24
- priority -1
24
+ priority(-1)
25
25
  end
26
26
  class Private < Object::Private
27
27
  applicable_if :private?
28
- priority -3
28
+ priority(-3)
29
29
  end
30
30
 
31
31
  class WithCodeExample < Object::WithCodeExample
@@ -14,7 +14,7 @@ module Inch
14
14
  # @see CodeObject::Ruby::MethodObject#has_many_parameters?
15
15
  class WithManyParameters < Base
16
16
  applicable_if :has_many_parameters?
17
- priority +2
17
+ priority(2)
18
18
  end
19
19
 
20
20
  # Role assigned to methods where the return value is typed in the
@@ -52,25 +52,25 @@ module Inch
52
52
  # @see CodeObject::Ruby::MethodObject#has_many_lines?
53
53
  class WithManyLines < Base
54
54
  applicable_if :has_many_lines?
55
- priority +2
55
+ priority(2)
56
56
  end
57
57
 
58
58
  # Role assigned to methods whose name end in a '!'
59
59
  class WithBangName < Base
60
60
  applicable_if :bang_name?
61
- priority +3
61
+ priority(3)
62
62
  end
63
63
 
64
64
  # Role assigned to methods whose name end in a '?'
65
65
  class WithQuestioningName < Base
66
66
  applicable_if :questioning_name?
67
- priority -4
67
+ priority(-4)
68
68
  end
69
69
 
70
70
  # Role assigned to methods which are aliased
71
71
  class HasAlias < Base
72
72
  applicable_if :has_alias?
73
- priority +2
73
+ priority(2)
74
74
  end
75
75
 
76
76
  # Role assigned to methods that are constructors
@@ -93,7 +93,7 @@ module Inch
93
93
  applicable_if :overridden?
94
94
  # It seems more important to document the overridden method,
95
95
  # than the overriding one
96
- priority -2
96
+ priority(-2)
97
97
 
98
98
  # This role doesnot assign a score.
99
99
  def score
@@ -44,7 +44,7 @@ module Inch
44
44
  # @see CodeObject::Ruby::MethodParameterObject#splat?
45
45
  class Splat < Base
46
46
  applicable_if :splat?
47
- priority +1
47
+ priority(1)
48
48
  end
49
49
 
50
50
  # Role assigned to parameters that are blocks, e.g. +&block+
@@ -52,7 +52,7 @@ module Inch
52
52
  # @see CodeObject::Ruby::MethodParameterObject#block?
53
53
  class Block < Base
54
54
  applicable_if :block?
55
- priority +1
55
+ priority(1)
56
56
  end
57
57
 
58
58
  # Role assigned to parameters that are documented, but not part of
@@ -61,7 +61,7 @@ module Inch
61
61
  # @see CodeObject::Ruby::MethodParameterObject#wrongly_mentioned?
62
62
  class WithWrongMention < Base
63
63
  applicable_if :wrongly_mentioned?
64
- priority +1
64
+ priority(1)
65
65
 
66
66
  def suggestion
67
67
  "The parameter '#{object.name}' seems not to be part of the " \
@@ -74,7 +74,7 @@ module Inch
74
74
  # @see CodeObject::Ruby::MethodParameterObject#bad_name?
75
75
  class WithBadName < Base
76
76
  applicable_if :bad_name?
77
- priority +1
77
+ priority(1)
78
78
  end
79
79
  end
80
80
  end
@@ -11,7 +11,7 @@ module Inch
11
11
  applicable_if :alias?
12
12
  # not sure about this yet,
13
13
  # but aliases should not show up high in the reports
14
- priority -7
14
+ priority(-7)
15
15
  end
16
16
 
17
17
  # Role assigned to objects with a describing comment (docstring)
@@ -33,7 +33,7 @@ module Inch
33
33
  # the object seems undocumented to Inch.
34
34
  class Tagged < Base
35
35
  applicable_if :has_unconsidered_tags?
36
- priority -1
36
+ priority(-1)
37
37
  end
38
38
 
39
39
  # Role assigned to objects explicitly or implicitly tagged not to be
@@ -42,7 +42,7 @@ module Inch
42
42
  # @see CodeObject::NodocHelper
43
43
  class TaggedAsNodoc < Base
44
44
  applicable_if :nodoc?
45
- priority -7
45
+ priority(-7)
46
46
  end
47
47
 
48
48
  # Role assigned to objects explicitly or implicitly tagged to be
@@ -56,7 +56,7 @@ module Inch
56
56
  # part of a private API.
57
57
  class TaggedAsInternalAPI < Base
58
58
  applicable_if :tagged_as_internal_api?
59
- priority -5
59
+ priority(-5)
60
60
  end
61
61
 
62
62
  # Role assigned to objects explicitly or implicitly tagged to be
@@ -65,31 +65,31 @@ module Inch
65
65
  # @see CodeObject::NodocHelper
66
66
  class TaggedAsPrivate < Base
67
67
  applicable_if :tagged_as_private?
68
- priority -5
68
+ priority(-5)
69
69
  end
70
70
 
71
71
  # Role assigned to objects declared in the top-level namespace
72
72
  class InRoot < Base
73
73
  applicable_if :in_root?
74
- priority +3
74
+ priority(3)
75
75
  end
76
76
 
77
77
  # Role assigned to public objects
78
78
  class Public < Base
79
79
  applicable_if :public?
80
- priority +2
80
+ priority(2)
81
81
  end
82
82
 
83
83
  # Role assigned to protected objects
84
84
  class Protected < Base
85
85
  applicable_if :protected?
86
- priority +1
86
+ priority(1)
87
87
  end
88
88
 
89
89
  # Role assigned to private objects
90
90
  class Private < Base
91
91
  applicable_if :private?
92
- priority -2
92
+ priority(-2)
93
93
  end
94
94
 
95
95
  # Role assigned to objects with a single code example
@@ -12,7 +12,7 @@ module Inch
12
12
  def debug(msg)
13
13
  return unless ENV['DEBUG']
14
14
  msg.to_s.lines.each do |line|
15
- trace edged :dark, line.gsub(/\n$/, '').dark
15
+ trace edged :dark, line.gsub(/\n$/, '').color(:dark)
16
16
  end
17
17
  end
18
18
 
@@ -1,3 +1,3 @@
1
1
  module Inch
2
- VERSION = '0.7.1'
2
+ VERSION = '0.8.0.rc1'
3
3
  end
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
2
2
 
3
3
  class Inch::CLI::Command::Output::Console
4
4
  def run_pry
5
- nil # instead of binding.pry
5
+ nil
6
6
  end
7
7
  end
8
8
 
@@ -41,7 +41,7 @@ describe ::Inch::CLI::Command::Stats do
41
41
  @command.run('--format=json')
42
42
  end
43
43
  refute out.empty?, 'there should be some output'
44
- assert err.empty?, "there should be no errors: #{err.yellow}"
44
+ assert err.empty?, "there should be no errors: #{err.color(:yellow)}"
45
45
  end
46
46
 
47
47
  it 'should output info when run with --format=yaml' do
@@ -49,7 +49,7 @@ describe ::Inch::CLI::Command::Stats do
49
49
  @command.run('--format=yaml')
50
50
  end
51
51
  refute out.empty?, 'there should be some output'
52
- assert err.empty?, "there should be no errors: #{err.yellow}"
52
+ assert err.empty?, "there should be no errors: #{err.color(:yellow)}"
53
53
  end
54
54
 
55
55
  it 'should output info when run with --help' do
@@ -26,7 +26,7 @@ describe ::Inch::CodeObject::Proxy do
26
26
  assert m.has_code_example?
27
27
  end
28
28
 
29
- def test_method_with_code_examples
29
+ def test_method_with_a_code_example
30
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?
@@ -37,12 +37,12 @@ describe ::Inch::CodeObject::Proxy do
37
37
  assert m.has_multiple_code_examples?
38
38
  end
39
39
 
40
- def test_method_with_code_examples
40
+ def test_method_with_tagged_code_examples
41
41
  m = @objects.find('Foo::Bar#method_with_tagged_example')
42
42
  assert m.has_multiple_code_examples?
43
43
  end
44
44
 
45
- def test_method_with_code_examples
45
+ def test_method_with_two_tagged_code_examples
46
46
  m = @objects.find('Foo::Bar#method_with_2tagged_examples')
47
47
  assert m.has_multiple_code_examples?
48
48
  end
@@ -8,7 +8,7 @@ describe ::Inch::Config do
8
8
  end
9
9
 
10
10
  it 'should parse .inch.yml if present' do
11
- dir = fixture_path(:ruby, :"inch-yml")
11
+ dir = fixture_path(:ruby, "inch-yml")
12
12
  config = Inch::Config.for(:ruby, dir)
13
13
  refute config.codebase.included_files.empty?
14
14
  refute config.codebase.excluded_files.empty?
@@ -525,6 +525,7 @@ describe ::Inch::Language::Ruby::CodeObject::MethodObject do
525
525
  describe 'YARDs reference tag on methods' do
526
526
  #
527
527
  it 'should recognize referenced docs' do
528
+ skip
528
529
  m1 = @objects.find('Foo#can?')
529
530
  assert m1.has_doc?
530
531
  refute m1.undocumented?
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.7.1
4
+ version: 0.8.0.rc1
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: 2016-03-08 00:00:00.000000000 Z
11
+ date: 2018-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.8.7.5
103
+ version: 0.9.12
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.8.7.5
110
+ version: 0.9.12
111
111
  description: Documentation measurement tool for Ruby, based on YARD.
112
112
  email:
113
113
  - rf@bamaru.de
@@ -400,12 +400,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
400
400
  version: '0'
401
401
  required_rubygems_version: !ruby/object:Gem::Requirement
402
402
  requirements:
403
- - - ">="
403
+ - - ">"
404
404
  - !ruby/object:Gem::Version
405
- version: '0'
405
+ version: 1.3.1
406
406
  requirements: []
407
407
  rubyforge_project:
408
- rubygems_version: 2.4.7
408
+ rubygems_version: 2.6.8
409
409
  signing_key:
410
410
  specification_version: 4
411
411
  summary: Documentation measurement tool for Ruby
@@ -485,4 +485,3 @@ test_files:
485
485
  - test/unit/utils/buffered_ui_test.rb
486
486
  - test/unit/utils/ui_test.rb
487
487
  - test/unit/utils/weighted_list_test.rb
488
- has_rdoc: