From 5612c14f1964d12252dc524cf60403d66083e37b Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Tue, 26 Apr 2016 12:40:28 -0700 Subject: [PATCH] Improve a bit more the snake_case file name warning reported by Style/FileName --- lib/rubocop/cop/style/file_name.rb | 2 +- spec/rubocop/cop/style/file_name_spec.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/rubocop/cop/style/file_name.rb b/lib/rubocop/cop/style/file_name.rb index 7ea28da2d6bf..48a87a4dd3c5 100644 --- a/lib/rubocop/cop/style/file_name.rb +++ b/lib/rubocop/cop/style/file_name.rb @@ -10,7 +10,7 @@ module Style # names. Ruby scripts (i.e. source files with a shebang in the # first line) are ignored. class FileName < Cop - MSG_SNAKE_CASE = 'The file name for this source (%s) ' \ + MSG_SNAKE_CASE = 'The name of this source file (`%s`) ' \ 'should use snake_case.'.freeze MSG_NO_DEFINITION = '%s should define a class or module ' \ 'called `%s`.'.freeze diff --git a/spec/rubocop/cop/style/file_name_spec.rb b/spec/rubocop/cop/style/file_name_spec.rb index a8792128a1d0..836b8d7f7f2e 100644 --- a/spec/rubocop/cop/style/file_name_spec.rb +++ b/spec/rubocop/cop/style/file_name_spec.rb @@ -162,8 +162,9 @@ it 'registers an offense' do expect(cop.offenses.size).to eq(1) - expect(cop.messages).to eq( - ['The file name for this source (a file.rb) should use snake_case.']) + expect(cop.messages) + .to eq(['The name of this source file (`a file.rb`) ' \ + 'should use snake_case.']) end end