style
This commit is contained in:
parent
2329844f50
commit
d963a1ae2f
@ -429,7 +429,7 @@ module RuboCop
|
|||||||
next unless shell_parameter.match?(/(bash|zsh|fish)/)
|
next unless shell_parameter.match?(/(bash|zsh|fish)/)
|
||||||
|
|
||||||
base_name = base_name.delete_prefix("_").delete_suffix(".fish")
|
base_name = base_name.delete_prefix("_").delete_suffix(".fish")
|
||||||
shell = shell.to_s.sub("_completion", "").to_sym
|
shell = shell.to_s.delete_suffix("_completion").to_sym
|
||||||
executable = executable.source
|
executable = executable.source
|
||||||
shell_parameter_stripped = shell_parameter.sub("bash", "").sub("zsh", "").sub("fish", "")
|
shell_parameter_stripped = shell_parameter.sub("bash", "").sub("zsh", "").sub("fish", "")
|
||||||
shell_parameter_format = if shell_parameter_stripped.empty?
|
shell_parameter_format = if shell_parameter_stripped.empty?
|
||||||
@ -452,11 +452,9 @@ module RuboCop
|
|||||||
replacement_args << "shell_parameter_format: #{shell_parameter_format}" unless shell_parameter_format.nil?
|
replacement_args << "shell_parameter_format: #{shell_parameter_format}" unless shell_parameter_format.nil?
|
||||||
|
|
||||||
offending_node(node)
|
offending_node(node)
|
||||||
replacement = if replacement_args.blank?
|
replacement = "generate_completions_from_executable"
|
||||||
"generate_completions_from_executable"
|
replacement += "(#{replacement_args.join(", ")})" unless replacement_args.blank?
|
||||||
else
|
|
||||||
"generate_completions_from_executable(#{replacement_args.join(", ")})"
|
|
||||||
end
|
|
||||||
problem "Use `#{replacement}` instead of `#{@offensive_node.source}`." do |corrector|
|
problem "Use `#{replacement}` instead of `#{@offensive_node.source}`." do |corrector|
|
||||||
corrector.replace(@offensive_node.source_range, replacement)
|
corrector.replace(@offensive_node.source_range, replacement)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user