Skip to content

Instantly share code, notes, and snippets.

@hcopperm
Created December 21, 2017 18:49
Show Gist options
  • Save hcopperm/be77fcbb6a7d60051e705307021212b9 to your computer and use it in GitHub Desktop.
Save hcopperm/be77fcbb6a7d60051e705307021212b9 to your computer and use it in GitHub Desktop.
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