Created
December 21, 2017 18:49
-
-
Save hcopperm/be77fcbb6a7d60051e705307021212b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bracket Line Up | |
What Rubocop wants: | |
``` | |
render({ | |
json: @property_transaction, | |
scope: { | |
user: current_user, | |
property_transaction: @property_transaction, | |
} | |
}) | |
``` | |
What we have: | |
``` | |
render({ | |
json: @property_transaction, | |
scope: { | |
user: current_user, | |
property_transaction: @property_transaction, | |
} | |
}) | |
``` | |
"Avoid the use of Perl-style backrefs." | |
What Rubocop wants: | |
``` | |
channel_matches_token = channel_name&.match(/\Aprivate-gmail-tokens-(\d+)\z/) && current_user.gmail_token_scope.where(id: Regexp.last_match(1)).exists? | |
``` | |
What we have: | |
``` | |
channel_matches_token = channel_name&.match(/\Aprivate-gmail-tokens-(\d+)\z/) && current_user.gmail_token_scope.where(id: $1).exists? | |
``` | |
begin..rescue | |
with begin: | |
``` | |
def send_to_intercom | |
begin | |
intercom_data = { client_status_updated_at: client_status.updated_at.to_i } | |
IntercomUtils.send_custom_data(gmail_token.user, intercom_data) | |
rescue Intercom::IntercomError => e | |
end | |
end | |
``` | |
what rubocop wants: | |
``` | |
def send_to_intercom | |
intercom_data = { client_status_updated_at: client_status.updated_at.to_i } | |
IntercomUtils.send_custom_data(gmail_token.user, intercom_data) | |
rescue Intercom::IntercomError => e | |
end | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment