make sure disable comments have content
This commit is contained in:
parent
d7af1e3527
commit
7b01442273
@ -28,7 +28,7 @@ module RuboCop
|
||||
|
||||
sig { params(line: String).returns(T::Boolean) }
|
||||
def comment?(line)
|
||||
line.strip.start_with? "#"
|
||||
line.strip.start_with?("#") && line.strip.delete_prefix("#") != ""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -25,6 +25,16 @@ RSpec.describe RuboCop::Cop::DisableComment, :config do
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "registers an offense if the comment is empty" do
|
||||
expect_offense(<<~RUBY)
|
||||
def something; end
|
||||
#
|
||||
# rubocop:disable Naming/AccessorMethodName
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add a clarifying comment to the RuboCop disable comment
|
||||
def get_decrypted_io; end
|
||||
RUBY
|
||||
end
|
||||
|
||||
it "doesn't register an offense" do
|
||||
expect_no_offenses(<<~RUBY)
|
||||
def something; end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user