Skip to content

Commit

Permalink
Rubocop autocorrected: Style/PerlBackrefs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidner committed Jun 5, 2015
1 parent 78cacb9 commit c567953
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
5 changes: 0 additions & 5 deletions .rubocop.yml
Expand Up @@ -151,11 +151,6 @@ Style/Next:
Style/OpMethod:
Enabled: false

# Offense count: 9
# Cop supports --auto-correct.
Style/PerlBackrefs:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
Style/Proc:
Expand Down
4 changes: 2 additions & 2 deletions src/ruby/yast/builtins.rb
Expand Up @@ -578,7 +578,7 @@ def self.sformat(format, *args)
when "%%"
"%"
when /%([1-9])/
pos = $1.to_i - 1
pos = Regexp.last_match(1).to_i - 1
if pos < args.size
tostring args[pos]
else
Expand Down Expand Up @@ -923,7 +923,7 @@ def self.tostring(val, width=nil)
# Yast: <YCPRef:list <map> bar (list <map> a)>
# Ruby: <YCPRef:list <map<any,any>> bar (list <map<any,any>>)>
val.signature.match /(.*)\((.*)\)/
"<YCPRef:#{$1}#{val.remote_method.name} (#{$2})>"
"<YCPRef:#{Regexp.last_match(1)}#{val.remote_method.name} (#{Regexp.last_match(2)})>"
else
y2warning 1, "tostring builtin called on wrong type #{val.class}"
return val.inspect
Expand Down
2 changes: 1 addition & 1 deletion src/ruby/yast/logger.rb
Expand Up @@ -22,7 +22,7 @@ def y2_logger_helper(level,args)
res = Builtins.sformat(*args)
res.gsub!(/%/,"%%") # reescape all %
caller[caller_frame] =~ /(.+):(\d+):in `([^']+)'/
y2_logger(level, "Ruby", $1, $2.to_i, "", res)
y2_logger(level, "Ruby", Regexp.last_match(1), Regexp.last_match(2).to_i, "", res)

if backtrace
y2_logger_helper(level, [2, "------------- Backtrace begin -------------"])
Expand Down
2 changes: 1 addition & 1 deletion src/ruby/yast/scr.rb
Expand Up @@ -109,7 +109,7 @@ def self.UnmountAgent (path)
def self.call_builtin_wrapper (*args)
# caller[0] is one of the functions above
caller[1].match BACKTRACE_REGEXP
call_builtin($1, $2.to_i, *args)
call_builtin(Regexp.last_match(1), Regexp.last_match(2).to_i, *args)
end
end
end
2 changes: 1 addition & 1 deletion src/ruby/yast/wfm.rb
Expand Up @@ -178,7 +178,7 @@ def self.CallFunction(client, *args)
def self.call_builtin_wrapper(*args)
# caller[0] is one of the functions above
caller[1].match BACKTRACE_REGEXP
call_builtin($1, $2.to_i, *args)
call_builtin(Regexp.last_match(1), Regexp.last_match(2).to_i, *args)
end

# @private wrapper to run client in ruby
Expand Down

0 comments on commit c567953

Please sign in to comment.