Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Fix ruby snippets linter issues #957

Merged
merged 7 commits into from
Jan 6, 2022

Conversation

alexisbcc
Copy link
Contributor

@alexisbcc alexisbcc commented Dec 11, 2021

This PR fixes the linter issues present in the new GH actions implementation for the Ruby code snippets.

The new GH actions implementation is done here: #946

The tests errors are not being fixed in this PR only the linter errors.

Changes:

  • Fix linter issues for Ruby code snippets.
  • Disabled Method Length rubocop rule.

@alexisbcc alexisbcc changed the base branch from master to change-travis-to-GH-actions December 11, 2021 23:43
@alexisbcc alexisbcc changed the title Fix ruby snippets Fix ruby snippets linter issues Dec 13, 2021
@@ -7,7 +7,7 @@
r.Dial callerId: '+15017122661' do |d|
# wrap the phone number or client name in the appropriate TwiML verb
# by checking if the number given has only digits and format symbols
if params['To'].match?(/^[\d\+\-\(\) ]+$/)
if params['To'].match?(/^[\d+\-() ]+$/)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubocop suggested this change. Remove unnecessary escapes.

@@ -11,5 +11,5 @@
# Update a role
role = service.roles('RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch
new_permissions = role.permissions | ['sendMediaMessage']
role = role.update(permission: new_permissions)
role.update(permission: new_permissions)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary reassignment.

@@ -10,7 +10,7 @@

service = client.notify.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')

service = service.update(
service.update(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary reassignment.

resp.message body: 'Hi!'
elsif body == 'bye'
when 'bye'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubocop suggested change if with case when.

@@ -9,7 +9,7 @@
taskqueue_sid = 'WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

capability = Twilio::JWT::TaskRouterCapability.new(
(account_sid, auth_token),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed extra parenthesis

'Caller' => '+12349013030',
'Digits' => '1234',
'From' => '+12349013030',
'To' => '+18005551212'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubocop warns about indentation.

@alexisbcc alexisbcc marked this pull request as ready for review December 13, 2021 19:57
response = Net::HTTP.get_response(URI.parse(media_location))

open('myFile.mp4', 'wb') do |file|
file.write(response.body)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the file download implementation to use a safe strategy instead of open() from open-uri

@alexisbcc alexisbcc requested a review from fefi95 January 5, 2022 21:54
Copy link
Contributor

@jefflinwood jefflinwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved!

@jefflinwood jefflinwood merged commit 5250407 into change-travis-to-GH-actions Jan 6, 2022
@jefflinwood jefflinwood deleted the fix-ruby-snippets branch January 6, 2022 17:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants