fix style

This commit is contained in:
Max Eisner 2022-08-10 17:44:52 +02:00
parent a56feff5d0
commit a175d6b7a1
No known key found for this signature in database
GPG Key ID: 4BF122C22879F0C8

View File

@ -431,7 +431,10 @@ module RuboCop
base_name = base_name.delete_prefix("_").delete_suffix(".fish") base_name = base_name.delete_prefix("_").delete_suffix(".fish")
shell = shell.to_s.delete_suffix("_completion").to_sym shell = shell.to_s.delete_suffix("_completion").to_sym
executable = executable.source executable = executable.source
shell_parameter_stripped = shell_parameter.delete_suffix("bash").delete_suffix("zsh").delete_suffix("fish") shell_parameter_stripped = shell_parameter
.delete_suffix("bash")
.delete_suffix("zsh")
.delete_suffix("fish")
shell_parameter_format = if shell_parameter_stripped.empty? shell_parameter_format = if shell_parameter_stripped.empty?
nil nil
elsif shell_parameter_stripped == "--" elsif shell_parameter_stripped == "--"
@ -447,7 +450,9 @@ module RuboCop
replacement_args << subcmd.inspect replacement_args << subcmd.inspect
replacement_args << "base_name: \"#{base_name}\"" unless base_name == @formula_name replacement_args << "base_name: \"#{base_name}\"" unless base_name == @formula_name
replacement_args << "shells: [:#{shell}]" replacement_args << "shells: [:#{shell}]"
replacement_args << "shell_parameter_format: #{shell_parameter_format.inspect}" unless shell_parameter_format.nil? unless shell_parameter_format.nil?
replacement_args << "shell_parameter_format: #{shell_parameter_format.inspect}"
end
offending_node(node) offending_node(node)
replacement = "generate_completions_from_executable(#{replacement_args.join(", ")})" replacement = "generate_completions_from_executable(#{replacement_args.join(", ")})"
@ -463,7 +468,7 @@ module RuboCop
end end
end end
# matches ({bash,zsh,fish}_completion/"_?foo{.fish}?").write Utils.safe_popen_read(foo, subcmd, shell_parameter) # match ({bash,zsh,fish}_completion/"_?foo{.fish}?").write Utils.safe_popen_read(foo, subcmd, shell_parameter)
def_node_search :correctable_shell_completion_node, <<~EOS def_node_search :correctable_shell_completion_node, <<~EOS
$(send $(send
(begin (begin