Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Mar 22, 2024
1 parent acb0f2e commit f84f48e
Show file tree
Hide file tree
Showing 30 changed files with 67 additions and 132 deletions.
47 changes: 7 additions & 40 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,22 @@
require:
- rubocop-performance
- rubocop-rspec
- rubocop-performance

# Omakase Ruby styling for Rails
inherit_gem:
rubocop-rails-omakase: rubocop.yml

AllCops:
NewCops: enable

Style/FrozenStringLiteralComment:
Enabled: false

Style/StringLiterals:
EnforcedStyle: double_quotes

Layout/LineLength:
Max: 100
Exclude:
- app/views/**/*.html.haml

Style/Documentation:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false

Metrics/BlockLength:
Enabled: true
Exclude:
- "**/spec/**/*.rb"

Style/BlockDelimiters:
Enabled: true
Exclude:
- "**/spec/**/*.rb"

Style/NumericLiterals:
RSpec/DescribedClass:
Enabled: false

Style/FormatStringToken:
RSpec/ExampleLength:
Enabled: false

RSpec/MultipleExpectations:
Enabled: false

RSpec/ExampleLength:
Max: 30

RSpec/DescribeClass:
Enabled: true
Exclude:
- "**/spec/system/**/*.rb"
- "**/spec/requests/**/*.rb"
- "**/spec/views/**/*.rb"

RSpec/DescribedClass:
Enabled: false
6 changes: 3 additions & 3 deletions components/app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ gem "sucker_punch"
gem "tts_voices", github: "somleng/tts_voices"

group :development, :test do
gem "rubocop"
gem "rubocop-performance"
gem "rubocop-rspec"
gem "rubocop-rails-omakase", require: false
gem "rubocop-performance", require: false
gem "rubocop-rspec", require: false
end

group :test do
Expand Down
15 changes: 14 additions & 1 deletion components/app/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,22 @@ GEM
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-minitest (0.35.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.24.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails-omakase (1.0.0)
rubocop
rubocop-minitest
rubocop-performance
rubocop-rails
rubocop-rspec (2.27.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
Expand Down Expand Up @@ -347,8 +360,8 @@ DEPENDENCIES
reel!
reel-rack!
rspec
rubocop
rubocop-performance
rubocop-rails-omakase
rubocop-rspec
sentry-ruby
simplecov
Expand Down
4 changes: 2 additions & 2 deletions components/app/app/models/twiml/connect_verb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module TwiML
class ConnectVerb < TwiMLNode
class StreamNoun < TwiMLNode
class Parser < TwiML::NodeParser
VALID_NOUNS = ["Parameter"].freeze
VALID_NOUNS = [ "Parameter" ].freeze

def parse(node)
super.merge(parameters: build_parameters)
Expand Down Expand Up @@ -85,7 +85,7 @@ def value
end

class Parser < TwiML::NodeParser
VALID_NOUNS = ["Stream"].freeze
VALID_NOUNS = [ "Stream" ].freeze

def parse(node)
super.merge(stream_noun:)
Expand Down
2 changes: 1 addition & 1 deletion components/app/app/models/twiml/loop_attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(value)
def times
return MAX_LOOP.times if value.to_s == "0"

[(value || 1).to_i, MAX_LOOP].min.times
[ (value || 1).to_i, MAX_LOOP ].min.times
end
end
end
2 changes: 1 addition & 1 deletion components/app/app/workflows/execute_dial.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def call
private

def redirect(params)
throw(:redirect, [verb.action, verb.method, params])
throw(:redirect, [ verb.action, verb.method, params ])
end

def build_callback_params(dial_status)
Expand Down
8 changes: 4 additions & 4 deletions components/app/app/workflows/execute_gather.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def call
private

def redirect(params)
throw(:redirect, [verb.action, verb.method, params])
throw(:redirect, [ verb.action, verb.method, params ])
end

def build_callback_params(digits)
Expand All @@ -52,11 +52,11 @@ def ask_parameters

def build_ask_parameter(nested_verb)
parameter = case nested_verb.name
when "Say"
when "Say"
build_say_parameter(nested_verb)
when "Play"
when "Play"
build_play_parameter(nested_verb)
end
end

parameter.repeat = nested_verb.loop.times.count
parameter
Expand Down
2 changes: 1 addition & 1 deletion components/app/app/workflows/execute_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def normalize_recording_url(raw_recording_url)
end

def redirect(params)
throw(:redirect, [verb.action, verb.method, params])
throw(:redirect, [ verb.action, verb.method, params ])
end

def build_callback_params(response, record_result)
Expand Down
2 changes: 1 addition & 1 deletion components/app/app/workflows/execute_redirect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ def call
private

def redirect
throw(:redirect, [verb.content, verb.method])
throw(:redirect, [ verb.content, verb.method ])
end
end
4 changes: 2 additions & 2 deletions components/app/config/initializers/aws_stubs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def to_h
stub_responses: {
describe_voices: {
voices: [
{ gender: "Female", id: "Joanna", language_code: "en-US", supported_engines: ["standard"] },
{ gender: "Female", id: "Lotte", language_code: "nl-NL", supported_engines: ["neural"] },
{ gender: "Female", id: "Joanna", language_code: "en-US", supported_engines: [ "standard" ] },
{ gender: "Female", id: "Lotte", language_code: "nl-NL", supported_engines: [ "neural" ] },
{ gender: "Female", id: "Vitoria", language_code: "pt-BR", supported_engines: %w[neural standard] }
]
}
Expand Down
6 changes: 3 additions & 3 deletions components/app/lib/encrypted_credentials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def credentials
end

def edit
Tempfile.open([file_path.basename.to_s.chomp(".enc"), ".yml"]) do |tmp_file|
Tempfile.open([ file_path.basename.to_s.chomp(".enc"), ".yml" ]) do |tmp_file|
if file_path.exist?
tmp_file.write(read_credentials)
tmp_file.flush
Expand Down Expand Up @@ -64,13 +64,13 @@ def handle_missing_key

def encrypt(content)
cipher = OpenSSL::Cipher.new(CIPHER).encrypt
cipher.key = [key].pack("H*")
cipher.key = [ key ].pack("H*")
cipher.update(content) + cipher.final
end

def decrypt(content)
cipher = OpenSSL::Cipher.new(CIPHER).decrypt
cipher.key = [key].pack("H*")
cipher.key = [ key ].pack("H*")
cipher.update(content) + cipher.final
end
end
Expand Down
2 changes: 1 addition & 1 deletion components/app/lib/rayo/command/twilio_stream/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def api
end

def args
[uuid, command_name, *command_args, Base64.urlsafe_encode64(metadata)].compact
[ uuid, command_name, *command_args, Base64.urlsafe_encode64(metadata) ].compact
end

def command_args
Expand Down
2 changes: 1 addition & 1 deletion components/app/lib/rayo/command/twilio_stream/start.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def command_name
end

def command_args
[url]
[ url ]
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions components/app/spec/call_controllers/dial_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

it "dials to plain text", :vcr, cassette: :build_routing_parameters do
controller = build_controller(
stub_voice_commands: [:play_audio, { dial: build_dial_status }],
stub_voice_commands: [ :play_audio, { dial: build_dial_status } ],
call_properties: {
account_sid: "ea471a9f-d4b3-4035-966e-f507b8da6d34",
from: "855715100860",
Expand Down Expand Up @@ -55,7 +55,7 @@

it "handles national dialing", :vcr, cassette: :build_routing_parameters_with_national_dialing do
controller = build_controller(
stub_voice_commands: [:play_audio, { dial: build_dial_status }],
stub_voice_commands: [ :play_audio, { dial: build_dial_status } ],
call_properties: {
account_sid: "ea471a9f-d4b3-4035-966e-f507b8da6d34",
to: "855715100860",
Expand All @@ -81,7 +81,7 @@

it "handles numbers without symmetric latching support", :vcr, cassette: :build_routing_parameters_without_symmetric_latching do
controller = build_controller(
stub_voice_commands: [{ dial: build_dial_status }],
stub_voice_commands: [ { dial: build_dial_status } ],
call_properties: {
account_sid: "ea471a9f-d4b3-4035-966e-f507b8da6d34"
}
Expand Down
4 changes: 2 additions & 2 deletions components/app/spec/call_controllers/gather_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</Response>
TWIML

stub_twiml_request(controller, response: [first_response, second_response])
stub_twiml_request(controller, response: [ first_response, second_response ])

controller.run

Expand Down Expand Up @@ -146,7 +146,7 @@

it "falls through the the next verb in the TwiML document if no input is received" do
controller = build_controller(
stub_voice_commands: [:play_audio, { ask: build_input_result(nil) } ]
stub_voice_commands: [ :play_audio, { ask: build_input_result(nil) } ]
)

stub_twiml_request(controller, response: <<~TWIML)
Expand Down
2 changes: 1 addition & 1 deletion components/app/spec/call_controllers/record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def build_call_controller(options)
</Response>
TWIML

stub_twiml_request(controller, response: [options.fetch(:twiml), second_response])
stub_twiml_request(controller, response: [ options.fetch(:twiml), second_response ])

controller
end
Expand Down
2 changes: 1 addition & 1 deletion components/app/spec/support/call_controller_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def build_fake_call(options = {})
)
allow(fake_call).to receive(:answer_time).and_return(
*Array(
options.fetch(:answer_time) { [nil, Time.now] }
options.fetch(:answer_time) { [ nil, Time.now ] }
)
)
fake_call
Expand Down
1 change: 1 addition & 0 deletions components/app/spec/support/mock_redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def message(&)
end

poll_for_messages
foo = [ "bar", "baz" ]
end

def publish(message)
Expand Down
23 changes: 0 additions & 23 deletions components/s3_mpeg/.rubocop.yml

This file was deleted.

2 changes: 1 addition & 1 deletion components/s3_mpeg/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def process
private

def tempfile(extension = nil, &block)
Tempfile.create([SecureRandom.uuid, extension].compact, &block)
Tempfile.create([ SecureRandom.uuid, extension ].compact, &block)
end

def convert_file(raw_file, converted_file)
Expand Down
23 changes: 0 additions & 23 deletions components/services/.rubocop.yml

This file was deleted.

4 changes: 2 additions & 2 deletions components/services/app/parsers/ecs_event_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def eni_private_ip_details

def private_ip
return eni_private_ip unless eni_private_ip.nil?
return ec2_instance_private_ip unless container_instance_arn.nil?
ec2_instance_private_ip unless container_instance_arn.nil?
end

def public_ip
Expand Down Expand Up @@ -119,7 +119,7 @@ def ec2_instance_id

def ec2_instance_details
@ec2_instance_details ||= ec2_client.describe_instances(
instance_ids: [ec2_instance_id]
instance_ids: [ ec2_instance_id ]
).to_h
end

Expand Down
Loading

0 comments on commit f84f48e

Please sign in to comment.