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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c318725a3a6fe8afca027a338421a451831204768bfbd0a36ad80beb28d64c2
|
4
|
+
data.tar.gz: cd62f5d9c99d4451f12ab079e5593da29d4a5e154d7654c36df4cc65e2b9d618
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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))
|
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.
|
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-
|
13
|
+
date: 2022-12-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubocop
|