Skip to content

Commit

Permalink
Fix Style/StringLiterals errors
Browse files Browse the repository at this point in the history
  • Loading branch information
paracycle committed Jun 16, 2021
1 parent 78d7598 commit 03483e8
Show file tree
Hide file tree
Showing 44 changed files with 119 additions and 119 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

require "bundler/gem_tasks"
require "rake/testtask"
Dir['tasks/**/*.rake'].each { |t| load t }
Dir["tasks/**/*.rake"].each { |t| load t }

Rake.application.options.trace = false

Rake::TestTask.new do |t|
t.libs << "lib"
t.libs << "spec"
t.warning = false
t.test_files = FileList['spec/**/*_spec.rb']
t.test_files = FileList["spec/**/*_spec.rb"]
end

task(:spec) do
Expand Down
2 changes: 1 addition & 1 deletion exe/tapioca
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/env ruby
# frozen_string_literal: true

require 'sorbet-runtime'
require "sorbet-runtime"

begin
T::Configuration.default_checked_level = :never
Expand Down
2 changes: 1 addition & 1 deletion lib/tapioca/cli.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# typed: true
# frozen_string_literal: true

require 'thor'
require "thor"

module Tapioca
module Cli; end
Expand Down
2 changes: 1 addition & 1 deletion lib/tapioca/compilers/dsl/action_controller_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def decorate(root, constant)

# Define the helpers method
root.path(constant) do |controller|
create_method(controller, 'helpers', return_type: helper_proxy_name)
create_method(controller, "helpers", return_type: helper_proxy_name)

# Create helper method module
controller.create_module(helper_methods_name) do |helper_methods|
Expand Down
2 changes: 1 addition & 1 deletion lib/tapioca/compilers/dsl/action_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def decorate(root, constant)
mailer,
mailer_method,
parameters: parameters,
return_type: '::ActionMailer::MessageDelivery',
return_type: "::ActionMailer::MessageDelivery",
class_method: true
)
end
Expand Down
10 changes: 5 additions & 5 deletions lib/tapioca/compilers/dsl/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ def compile_method_parameters_to_parlour(method_def)
when :req
::Parlour::RbiGenerator::Parameter.new(name, type: method_type)
when :opt
::Parlour::RbiGenerator::Parameter.new(name, type: method_type, default: 'T.unsafe(nil)')
::Parlour::RbiGenerator::Parameter.new(name, type: method_type, default: "T.unsafe(nil)")
when :rest
::Parlour::RbiGenerator::Parameter.new("*#{name}", type: method_type)
when :keyreq
::Parlour::RbiGenerator::Parameter.new("#{name}:", type: method_type)
when :key
::Parlour::RbiGenerator::Parameter.new("#{name}:", type: method_type, default: 'T.unsafe(nil)')
::Parlour::RbiGenerator::Parameter.new("#{name}:", type: method_type, default: "T.unsafe(nil)")
when :keyrest
::Parlour::RbiGenerator::Parameter.new("**#{name}", type: method_type)
when :block
Expand All @@ -127,7 +127,7 @@ def compile_method_parameters_to_parlour(method_def)
end
def compile_method_return_type_to_parlour(method_def)
signature = T::Private::Methods.signature_for_method(method_def)
return_type = signature.nil? ? 'T.untyped' : signature.return_type.to_s
return_type = signature.nil? ? "T.untyped" : signature.return_type.to_s
# Map <VOID> to `nil` since `nil` means a `void` return for Parlour
return_type = nil if return_type == "<VOID>"
# Map <NOT-TYPED> to `T.untyped`
Expand All @@ -145,7 +145,7 @@ def compile_method_return_type_to_parlour(method_def)
def parameters_types_from_signature(method_def, signature)
params = T.let([], T::Array[String])

return method_def.parameters.map { 'T.untyped' } unless signature
return method_def.parameters.map { "T.untyped" } unless signature

# parameters types
signature.arg_types.each { |arg_type| params << arg_type[1].to_s }
Expand All @@ -158,7 +158,7 @@ def parameters_types_from_signature(method_def, signature)

# special case `.void` in a proc
unless signature.block_name.nil?
params << signature.block_type.to_s.gsub('returns(<VOID>)', 'void')
params << signature.block_type.to_s.gsub("returns(<VOID>)", "void")
end

params
Expand Down
4 changes: 2 additions & 2 deletions lib/tapioca/compilers/dsl/frozen_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def decorate(root, constant)

record.create_module(module_name) do |mod|
attributes.each do |attribute|
create_method(mod, "#{attribute}?", return_type: 'T::Boolean')
create_method(mod, attribute.to_s, return_type: 'T.untyped')
create_method(mod, "#{attribute}?", return_type: "T::Boolean")
create_method(mod, attribute.to_s, return_type: "T.untyped")
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/tapioca/compilers/dsl/protobuf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ def field_of(descriptor)
# how Google names map entries.
# https://github.com/protocolbuffers/protobuf/blob/f82e26/ruby/ext/google/protobuf_c/defs.c#L1963-L1966
if descriptor.submsg_name.to_s.end_with?("_MapEntry_#{descriptor.name}")
key = descriptor.subtype.lookup('key')
value = descriptor.subtype.lookup('value')
key = descriptor.subtype.lookup("key")
value = descriptor.subtype.lookup("value")

key_type = type_of(key)
value_type = type_of(value)
Expand Down
10 changes: 5 additions & 5 deletions lib/tapioca/compilers/dsl/sidekiq_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ def decorate(root, constant)
# accept a datetime, time, or numeric but we're typing them differently so they
# semantically make sense.
at_params = [
Parlour::RbiGenerator::Parameter.new('interval', type: 'T.any(DateTime, Time)'),
Parlour::RbiGenerator::Parameter.new("interval", type: "T.any(DateTime, Time)"),
*async_params,
]
in_params = [
Parlour::RbiGenerator::Parameter.new('interval', type: 'Numeric'),
Parlour::RbiGenerator::Parameter.new("interval", type: "Numeric"),
*async_params,
]

create_method(worker, 'perform_async', parameters: async_params, return_type: 'String', class_method: true)
create_method(worker, 'perform_at', parameters: at_params, return_type: 'String', class_method: true)
create_method(worker, 'perform_in', parameters: in_params, return_type: 'String', class_method: true)
create_method(worker, "perform_async", parameters: async_params, return_type: "String", class_method: true)
create_method(worker, "perform_at", parameters: at_params, return_type: "String", class_method: true)
create_method(worker, "perform_in", parameters: in_params, return_type: "String", class_method: true)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/tapioca/compilers/dsl/smart_properties.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def type_for(property)
"T::Boolean"
elsif Array(accepter).all? { |a| a.is_a?(Module) }
accepters = Array(accepter)
types = accepters.map { |mod| name_of(mod) }.join(', ')
types = accepters.map { |mod| name_of(mod) }.join(", ")
types = "T.any(#{types})" if accepters.size > 1
types
else
Expand Down
2 changes: 1 addition & 1 deletion lib/tapioca/compilers/dsl_compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def generator_filter(requested_generators)
generators = requested_generators.map(&:downcase)

proc do |klass|
generator = klass.name&.sub(/^Tapioca::Compilers::Dsl::/, '')&.downcase
generator = klass.name&.sub(/^Tapioca::Compilers::Dsl::/, "")&.downcase
generators.include?(generator)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/tapioca/compilers/requires_compiler.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# typed: strict
# frozen_string_literal: true

require 'spoom'
require "spoom"

module Tapioca
module Compilers
Expand Down Expand Up @@ -87,7 +87,7 @@ def path_parts(path)
sig { params(files: T::Enumerable[String], name: String).returns(T::Boolean) }
def name_in_project?(files, name)
files.any? do |file|
File.basename(file, '.rb') == name
File.basename(file, ".rb") == name
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/tapioca/compilers/sorbet.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# typed: true
# frozen_string_literal: true

require 'pathname'
require 'shellwords'
require "pathname"
require "shellwords"

module Tapioca
module Compilers
Expand All @@ -20,7 +20,7 @@ def run(*args)
sorbet_path,
"--quiet",
*args,
].join(' '),
].join(" "),
err: "/dev/null"
).read
end
Expand Down
6 changes: 3 additions & 3 deletions lib/tapioca/compilers/symbol_table/symbol_generator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# typed: true
# frozen_string_literal: true

require 'pathname'
require "pathname"

module Tapioca
module Compilers
Expand Down Expand Up @@ -102,7 +102,7 @@ def compile(tree, name, constant)
return unless constant
return unless name
return if name.strip.empty?
return if name.start_with?('#<')
return if name.start_with?("#<")
return if name.downcase == name
return if alias_namespaced?(name)
return if seen?(name)
Expand Down Expand Up @@ -511,7 +511,7 @@ def struct_method?(constant, method_name)
constant
.props
.keys
.include?(method_name.gsub(/=$/, '').to_sym)
.include?(method_name.gsub(/=$/, "").to_sym)
end

sig do
Expand Down
6 changes: 3 additions & 3 deletions lib/tapioca/compilers/symbol_table/symbol_loader.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# typed: true
# frozen_string_literal: true

require 'json'
require 'tempfile'
require "json"
require "tempfile"

module Tapioca
module Compilers
Expand All @@ -25,7 +25,7 @@ def ignore_symbol?(symbol)

sig { params(paths: T::Array[String]).returns(T::Set[String]) }
def load_symbols(paths)
output = T.cast(Tempfile.create('sorbet') do |file|
output = T.cast(Tempfile.create("sorbet") do |file|
file.write(Array(paths).join("\n"))
file.flush

Expand Down
2 changes: 1 addition & 1 deletion lib/tapioca/config_builder.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# typed: strict
# frozen_string_literal: true

require 'yaml'
require "yaml"

module Tapioca
class ConfigBuilder
Expand Down
2 changes: 1 addition & 1 deletion lib/tapioca/constant_locator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# typed: true
# frozen_string_literal: true

require 'set'
require "set"

module Tapioca
# Registers a TracePoint immediately upon load to track points at which
Expand Down
8 changes: 4 additions & 4 deletions lib/tapioca/generator.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# typed: strict
# frozen_string_literal: true

require 'pathname'
require 'thor'
require "pathname"
require "thor"
require "tapioca/core_ext/string"

module Tapioca
Expand Down Expand Up @@ -222,7 +222,7 @@ def require_gem_file
say(" Done", :green)
unless bundle.missing_specs.empty?
say(" completed with missing specs: ")
say(bundle.missing_specs.join(', '), :yellow)
say(bundle.missing_specs.join(", "), :yellow)
end
puts
end
Expand Down Expand Up @@ -316,7 +316,7 @@ def existing_rbi_filenames(requested_constants, path: config.outpath)
sig { returns(T::Hash[String, String]) }
def existing_rbis
@existing_rbis ||= Pathname.glob((config.outpath / "*@*.rbi").to_s)
.map { |f| T.cast(f.basename(".*").to_s.split('@', 2), [String, String]) }
.map { |f| T.cast(f.basename(".*").to_s.split("@", 2), [String, String]) }
.to_h
end

Expand Down
4 changes: 2 additions & 2 deletions sorbet/tapioca/require.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
require "google/protobuf"
require "money"
require "rubocop"
require 'rake/testtask'
require 'sidekiq'
require "rake/testtask"
require "sidekiq"
2 changes: 1 addition & 1 deletion spec/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def spec_test_class
def target_class_name
# Get the name of the class under test from the name of the
# test class
T.must(spec_test_class.name).gsub(/Spec$/, '')
T.must(spec_test_class.name).gsub(/Spec$/, "")
end

sig { returns(String) }
Expand Down
6 changes: 3 additions & 3 deletions spec/support/repo/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# typed: true
# frozen_string_literal: true

require 'smart_properties'
require 'active_support/all'
require 'baz'
require "smart_properties"
require "active_support/all"
require "baz"

# Fake as much of Rails as we can
module Rails
Expand Down
2 changes: 1 addition & 1 deletion spec/support/repo/postrequire.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: strict
# frozen_string_literal: true

require 'foo/secret'
require "foo/secret"
2 changes: 1 addition & 1 deletion spec/support/repo/postrequire_faulty.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: strict
# frozen_string_literal: true

require 'foo/will_fail'
require "foo/will_fail"
2 changes: 1 addition & 1 deletion spec/support/require/multi/file1.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# typed: strict
# frozen_string_literal: true
require 'c'
require "c"
2 changes: 1 addition & 1 deletion spec/support/require/multi/file2.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# typed: strict
# frozen_string_literal: true
require 'd'
require "d"
2 changes: 1 addition & 1 deletion spec/support/require/multi/file3.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# typed: strict
# frozen_string_literal: true
require 'e'
require "e"
2 changes: 1 addition & 1 deletion spec/support/require/multi/lib/file1.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# typed: strict
# frozen_string_literal: true
require 'a'
require "a"
2 changes: 1 addition & 1 deletion spec/support/require/multi/lib/file2.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# typed: strict
# frozen_string_literal: true
require 'b'
require "b"
4 changes: 2 additions & 2 deletions spec/support/require/project_ignore/file1.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: strict
# frozen_string_literal: true
require 'a'
require 'libc'
require "a"
require "libc"
4 changes: 2 additions & 2 deletions spec/support/require/project_ignore/file2.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: strict
# frozen_string_literal: true
require 'b'
require 'libd'
require "b"
require "libd"
2 changes: 1 addition & 1 deletion spec/support/require/project_ignore/lib/a.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# typed: strict
# frozen_string_literal: true
require 'liba'
require "liba"
2 changes: 1 addition & 1 deletion spec/support/require/project_ignore/lib/b.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# typed: strict
# frozen_string_literal: true
require 'libb'
require "libb"
Loading

0 comments on commit 03483e8

Please sign in to comment.