Skip to content

Address yard issues #1379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 26, 2015
Merged

Address yard issues #1379

merged 5 commits into from
May 26, 2015

Conversation

cupakromer
Copy link
Member

This makes YARD available in the dev/test environment again, fixing the bin/yard failure. It also updates the docs to get minimal 100% coverage and addresses the outstanding warnings.

Fix #1297

This fixes the error generated by the script when attempting to check
documentation coverage:

> /.gem/ruby/2.2.2/gems/bundler-1.9.4/lib/bundler/rubygems_integration.rb:316:in `block in replace_bin_path': can't find executable yard (Gem::Exception)
>         from bin/yard:16:in `<main>'
Both of these are meant to be private APIs. They were not marked as such
before because the `bin/yard` command was failing previously.
> [warn]: in YARD::Handlers::Ruby::MethodHandler: Undocumentable method defined on object instance
> [warn]:         in file 'lib/rspec/rails/configuration.rb':73:
>
>         73: def config.render_views=(val)
>
> [warn]: in YARD::Handlers::Ruby::MethodHandler: Undocumentable method defined on object instance
> [warn]:         in file 'lib/rspec/rails/configuration.rb':77:
>
>         77: def config.render_views
>
> [warn]: in YARD::Handlers::Ruby::MethodHandler: Undocumentable method defined on object instance
> [warn]:         in file 'lib/rspec/rails/configuration.rb':81:
>
>         81: def config.render_views?
>
> [warn]: in YARD::Handlers::Ruby::MethodHandler: Undocumentable method defined on object instance
> [warn]:         in file 'lib/rspec/rails/configuration.rb':85:
>
>         85: def config.infer_spec_type_from_file_location!
>
> [warn]: Syntax error in `lib/generators/rspec/mailer/templates/preview.rb`:(1,1): syntax error, unexpected '<'
> [warn]: in YARD::Handlers::Ruby::MixinHandler: Undocumentable mixin: YARD::Parser::UndocumentableError for class RSpec::Rails::RoutingExampleGroup
> [warn]:         in file 'lib/rspec/rails/example/routing_example_group.rb':11:
>
>         11: include RSpec::Rails::AssertionDelegator.new(ActionDispatch::Assertions::RoutingAssertions)
>
> [warn]: in YARD::Handlers::Ruby::MixinHandler: Undocumentable mixin: YARD::Parser::UndocumentableError for class RSpec::Rails::ControllerExampleGroup
> [warn]:         in file 'lib/rspec/rails/example/controller_example_group.rb':12:
>
>         12: include RSpec::Rails::AssertionDelegator.new(ActionDispatch::Assertions::RoutingAssertions)
>
> [warn]: Syntax error in `lib/generators/rspec/install/templates/spec/rails_helper.rb`:(23,1): syntax error, unexpected '<', expecting end-of-input
This addresses doc coverage issues with the most recent release of YARD.
def config.render_views=(val)
self.rendering_views = val
end
config.instance_exec do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is instance_exec really necessary to fix up the yard?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YARD issues warnings about writing the methods directly on the object:

[warn]: in YARD::Handlers::Ruby::MethodHandler: Undocumentable method defined on object instance
[warn]: in file 'lib/rspec/rails/configuration.rb':73:

    73: def config.render_views=(val)

Using instance_exec provides access to the same singleton scope allowing us to write the methods. Another option would be place all of those methods into a module and then access the singleton class directly (providing proper 1.8.7 backwards compat) to include the aforementioned module.

@myronmarston
Copy link
Member

LGTM

This fixes the access to the controller attribute, making it clear that
the setter should be a `private` internal API. This was reflected
previously in the YARD doc, but that did not match the code.
cupakromer added a commit that referenced this pull request May 26, 2015
@cupakromer cupakromer merged commit 57d26eb into master May 26, 2015
@cupakromer cupakromer deleted the address-yard-issues branch May 26, 2015 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Address YARD warnings and get docs back to 100%
3 participants