rubocop-minitest 0.25.0 → 0.25.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49b67a4071b6ba9e1499054507097424e25948f916e3ebbcf65603d4e0806b94
4
- data.tar.gz: 46a351626a6ec6625d5e29fc0f04c47d61844bc28e2745172ea0bb8344936751
3
+ metadata.gz: 5c318725a3a6fe8afca027a338421a451831204768bfbd0a36ad80beb28d64c2
4
+ data.tar.gz: cd62f5d9c99d4451f12ab079e5593da29d4a5e154d7654c36df4cc65e2b9d618
5
5
  SHA512:
6
- metadata.gz: 4abcc9e3035a7e7a2902b27442f02f46a9494a2894acb5f5c98d18293d4c0d1ab94e32b2508bf1b23988cca436f7b7d4fd784dfe09fc21fae0c70ba2d6ef80ec
7
- data.tar.gz: 6d669e4ff6e60a729a64c5ea87d4f91a20022f4a47cda95a52a10f6084de258a497d66ceeb71c0c08c1e8bbf8538823ac534349ec7644c24ab35df5b8317b30f
6
+ metadata.gz: e93c50c17543b7618acfb1b78566d0be02b476469a32b74855b8393917286695ff0414975b71ede3c749bf7d2191550a3ae2cdb4a98cd481bfd528d510b2eca2
7
+ data.tar.gz: c2b106af9e68a77ace2c9eb44a49fbf2afea7d854cd3985c0d845dfa16ab39e9dcd50700d1e16f093d44014444a1946fe34641988033bab4988361c5e7ea06ed
@@ -6,6 +6,9 @@ module RuboCop
6
6
  # Tries to detect when a user accidentally used
7
7
  # `assert` when they meant to use `assert_equal`.
8
8
  #
9
+ # NOTE: The second argument to the `assert` method named `message` and `msg` is allowed.
10
+ # Because their names are inferred as message arguments.
11
+ #
9
12
  # @safety
10
13
  # This cop is unsafe because it is not possible to determine
11
14
  # whether the second argument of `assert` is a message or not.
@@ -19,10 +22,13 @@ module RuboCop
19
22
  # assert_equal(3, my_list.length)
20
23
  # assert_equal(expected, actual)
21
24
  # assert(foo, 'message')
25
+ # assert(foo, message)
26
+ # assert(foo, msg)
22
27
  #
23
28
  class AssertWithExpectedArgument < Base
24
29
  MSG = 'Did you mean to use `assert_equal(%<arguments>s)`?'
25
30
  RESTRICT_ON_SEND = %i[assert].freeze
31
+ MESSAGE_VARIABLES = %w[message msg].freeze
26
32
 
27
33
  def_node_matcher :assert_with_two_arguments?, <<~PATTERN
28
34
  (send nil? :assert $_ $_)
@@ -30,7 +36,7 @@ module RuboCop
30
36
 
31
37
  def on_send(node)
32
38
  assert_with_two_arguments?(node) do |_expected, message|
33
- return if message.str_type? || message.dstr_type?
39
+ return if message.str_type? || message.dstr_type? || MESSAGE_VARIABLES.include?(message.source)
34
40
 
35
41
  arguments = node.arguments.map(&:source).join(', ')
36
42
  add_offense(node, message: format(MSG, arguments: arguments))
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Minitest
5
5
  # This module holds the RuboCop Minitest version information.
6
6
  module Version
7
- STRING = '0.25.0'
7
+ STRING = '0.25.1'
8
8
 
9
9
  def self.document_version
10
10
  STRING.match('\d+\.\d+').to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-12-10 00:00:00.000000000 Z
13
+ date: 2022-12-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop