dkubb / yardstick

A tool for verifying YARD documentation coverage
http://wiki.github.com/dkubb/yardstick
MIT License
173 stars 22 forks source link

Asking for documentation on private methods #49

Open aaronmallen opened 7 years ago

aaronmallen commented 7 years ago

Given a module:

module Foo
  module_function

  def some_public_method
    'foo'
  end

  class << self
    private

    def some_private_method
      'bar'
    end
  end
end

Problem:

yardstick will require yardstick to be defined on private methods:

Foo.some_private_method: The public/semipublic method should have an example specified
Foo.some_private_method: The method summary should be specified
Foo.some_private_method: The @return tag should be specified

Expectation

yardstick should not require documentation on private methods.

backus commented 7 years ago

Are you sure it isn't configurable? Checkout the readme. Specifically...


  ApiTag::PrivateMethod:
    enabled: true
    exclude: []
aaronmallen commented 7 years ago

yeah I can reproduce this given options:

---
threshold: 95
rules:
  ApiTag::Presence:
    enabled: false
    exclude: []
  ApiTag::Inclusion:
    enabled: false
    exclude: []
  ApiTag::ProtectedMethod:
    enabled: false
    exclude: []
  ApiTag::PrivateMethod:
    enabled: false
    exclude: []
  ExampleTag:
    enabled: true
    exclude: []
  ExampleTag::ProtectedMethod:
    enabled: false
  ExampleTag::PrivateMethod:
    enabled: false
  ReturnTag:
    enabled: true
    exclude: []
  Summary::Presence:
    enabled: true
    exclude: []
  Summary::Length:
    enabled: true
    exclude: []
  Summary::Delimiter:
    enabled: true
    exclude: []
  Summary::SingleLine:
    enabled: true
    exclude: []
Foo.some_private_method: The public/semipublic method should have an example specified
Foo.some_private_method: The method summary should be specified
Foo.some_private_method: The @return tag should be specified

Even further verification... I tried:

---
threshold: 95
rules:
  ApiTag::Presence:
    enabled: false
    exclude: []
  ApiTag::Inclusion:
    enabled: false
    exclude: []
  ApiTag::ProtectedMethod:
    enabled: false
    exclude: []
  ApiTag::PrivateMethod:
    enabled: false
    exclude: []
  ExampleTag::PublicMethod:
    enabled: true
    exclude: []
  ExampleTag::ProtectedMethod:
    enabled: false
    exclude: []
  ExampleTag::PrivateMethod:
    enabled: false
    exclude: []
  ReturnTag::PublicMethod:
    enabled: true
    exclude: []
  ReturnTag::ProtectedMethod:
    enabled: false
    exclude: []
  ReturnTag::PrivateMethod:
    enabled: false
    exclude: []
  Summary::Presence:
    enabled: true
    exclude: []
  Summary::Length:
    enabled: true
    exclude: []
  Summary::Delimiter:
    enabled: true
    exclude: []
  Summary::SingleLine:
    enabled: true
    exclude: []
Foo.some_private_method: The public/semipublic method should have an example specified
Foo.some_private_method: The method summary should be specified
Foo.some_private_method: The @return tag should be specified

It would also appear it ignores private in a class as well:

module Foo
  class Bar
    def some_public_function
      'foo'
    end

    private

    def some_private_method
      'bar'
    end
  end
end
Foo::Bar.some_private_method: The public/semipublic method should have an example specified
Foo::Bar.some_private_method: The method summary should be specified
Foo::Bar.some_private_method: The @return tag should be specified

Relevant information:

spec.add_development_dependency 'yard', '~> 0.9'
spec.add_development_dependency 'yardstick', '~> 0.9'
$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]
$ yard -v
yard 0.9.8
$ yardstick -v
yardstick 0.9.9