File tree 2 files changed +5
-8
lines changed
2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -69,15 +69,13 @@ def add_no_arg_offense(node)
69
69
end
70
70
71
71
def check_for_unused_proxy ( block , proxy )
72
- name , = *proxy
73
-
74
72
find_arg_usage ( block ) do |usage |
75
- return if usage . include? ( s ( :lvar , name ) )
73
+ return if usage . include? ( s ( :lvar , proxy . name ) )
76
74
end
77
75
78
76
add_offense (
79
77
proxy ,
80
- message : format ( MSG_UNUSED_ARG , arg : name )
78
+ message : format ( MSG_UNUSED_ARG , arg : proxy . name )
81
79
)
82
80
end
83
81
Original file line number Diff line number Diff line change @@ -67,11 +67,10 @@ def single_element_array?(node)
67
67
end
68
68
69
69
def autocorrect_hash_arg ( corrector , arg )
70
- key , value = *arg . children . first
71
-
72
- corrector . replace ( arg , key_to_arg ( key ) )
70
+ pair = arg . pairs . first
71
+ corrector . replace ( arg , key_to_arg ( pair . key ) )
73
72
corrector . insert_after ( arg . parent . loc . end ,
74
- ".and_return(#{ value . source } )" )
73
+ ".and_return(#{ pair . value . source } )" )
75
74
end
76
75
77
76
def autocorrect_array_arg ( corrector , arg )
You can’t perform that action at this time.
0 commit comments