Skip to content
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

Fix an error for Style/Documentation #10234

Merged
merged 1 commit into from Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/fix_error_for_style_documentation
@@ -0,0 +1 @@
* [#10234](https://github.com/rubocop/rubocop/pull/10234): Fix an error for `Style/Documentation` when using a cbase class. ([@koic][])
2 changes: 1 addition & 1 deletion lib/rubocop/cop/style/documentation.rb
Expand Up @@ -176,7 +176,7 @@ def identifier(node)
end

def qualify_const(node)
return if node.nil?
return if node.nil? || node.cbase_type?

[qualify_const(node.namespace), node.short_name].compact
end
Expand Down
10 changes: 10 additions & 0 deletions spec/rubocop/cop/style/documentation_spec.rb
Expand Up @@ -17,6 +17,16 @@ def method
RUBY
end

it 'registers an offense for non-empty cbase class' do
expect_offense(<<~RUBY)
class ::MyClass
^^^^^^^^^^^^^^^ Missing top-level documentation comment for `class MyClass`.
def method
end
end
RUBY
end

it 'does not consider comment followed by empty line to be class documentation' do
expect_offense(<<~RUBY)
# Copyright 2014
Expand Down