Skip to content

Commit

Permalink
fix rubocop errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeheft committed Jul 8, 2024
1 parent 658a115 commit 916b2d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Layout/SpaceInsideBlockBraces:
Lint/UnusedMethodArgument:
AutoCorrect: false
Metrics/AbcSize:
CountRepeatedAttributes: false
Max: 20
Exclude:
- "app/models/application_record.rb"
Metrics/BlockLength:
Expand All @@ -47,6 +49,7 @@ Metrics/CyclomaticComplexity:
Exclude:
- "lib/rubocop/cop/custom/*.rb"
Metrics/MethodLength:
Max: 20
Exclude:
- "lib/rubocop/cop/custom/*.rb"
- "app/models/application_record.rb"
Expand Down
7 changes: 5 additions & 2 deletions lib/rides/commands/get_routes_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ def call(rides:)
)
end

handle_response(response, key)
end

private def handle_response(response, key)
if response.status != 200
result = JSON.parse(response.body, symbolize_names: true)
error = result.first[:error]
Expand All @@ -117,9 +121,8 @@ def call(rides:)
rescue JSON::ParserError => e
message = e.message
Rails.logger.warn "Attemped to parse invalid JSON: #{message}"
raise JSONParserError, message
raise ApiException::JSONParserError, message
end

private def cache_response!(key, value)
CACHE.set(key, value)
end
Expand Down

0 comments on commit 916b2d5

Please sign in to comment.