Skip to content

Commit

Permalink
[Fix rubocop#5683] Fix message for Naming/UncommunicativeXParamName cops
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Faber committed Mar 15, 2018
1 parent 059b1c5 commit 7cc01a2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

### Bug fixes

* [#5683](https://github.com/bbatsov/rubocop/issues/5683): Fix message for Naming/UncommunicativeXParamName cops. ([@jlfaber][])
* [#5680](https://github.com/bbatsov/rubocop/issues/5680): Fix Layout/ElseAlignment for rescue/else/ensure inside do/end blocks. ([@YukiJikumaru][])
* [#5642](https://github.com/bbatsov/rubocop/pull/5642): Fix Style/Documentation :nodoc: for compact-style nested modules/classes. ([@ojab][])
* [#5648](https://github.com/bbatsov/rubocop/issues/5648): Suggest valid memoized instance variable for predicate method. ([@satyap][])
Expand Down Expand Up @@ -3255,3 +3256,4 @@
[@hamada14]: https://github.com/hamada14
[@anthony-robin]: https://github.com/anthony-robin
[@YukiJikumaru]: https://github.com/YukiJikumaru
[@jlfaber]: https://github.com/jlfaber
4 changes: 2 additions & 2 deletions lib/rubocop/cop/mixin/uncommunicative_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module Cop
module UncommunicativeName
CASE_MSG = 'Only use lowercase characters for %<name_type>s.'.freeze
NUM_MSG = 'Do not end %<name_type>s with a number.'.freeze
LENGTH_MSG = '%<name_type>s must be longer than %<min>s ' \
'characters.'.freeze
LENGTH_MSG = '%<name_type>s must be at least %<min>s ' \
'characters long.'.freeze
FORBIDDEN_MSG = 'Do not use %<name>s as a name for a ' \
'%<name_type>s.'.freeze

Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ def method(foo, bar, qux, fred, arg5, f) end #{'#' * 45}
expect($stdout.string).to eq(<<-RESULT.strip_indent)
== example/example1.rb ==
C: 1: 11: Metrics/ParameterLists: Avoid parameter lists longer than 5 parameters. [6/5]
C: 1: 39: Naming/UncommunicativeMethodParamName: Method parameter must be longer than 3 characters.
C: 1: 39: Naming/UncommunicativeMethodParamName: Method parameter must be at least 3 characters long.
C: 1: 46: Style/CommentedKeyword: Do not place comments on the same line as the def keyword.
E: 1: 81: Metrics/LineLength: Line is too long. [90/80]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
it 'registers offense when param is less than minimum length' do
expect_offense(<<-RUBY.strip_indent)
something do |x|
^ Block parameter must be longer than 2 characters.
^ Block parameter must be at least 2 characters long.
do_stuff
end
RUBY
Expand All @@ -61,7 +61,7 @@
RUBY
expect(cop.offenses.size).to eq(3)
expect(cop.messages).to eq [
'Block parameter must be longer than 2 characters.',
'Block parameter must be at least 2 characters long.',
'Do not end block parameter with a number.',
'Only use lowercase characters for block parameter.'
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def self.something(foo, bar1)
it 'registers offense when parameter is less than minimum length' do
expect_offense(<<-RUBY.strip_indent)
def something(ab)
^^ Method parameter must be longer than 3 characters.
^^ Method parameter must be at least 3 characters long.
do_stuff
end
RUBY
Expand Down Expand Up @@ -120,7 +120,7 @@ def self.something(y, num1, oFo)
RUBY
expect(cop.offenses.size).to eq(3)
expect(cop.messages).to eq [
'Method parameter must be longer than 3 characters.',
'Method parameter must be at least 3 characters long.',
'Do not end method parameter with a number.',
'Only use lowercase characters for method parameter.'
]
Expand Down

0 comments on commit 7cc01a2

Please sign in to comment.