Skip to content

Commit

Permalink
linter: Enable linter on lib (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego authored Feb 24, 2023
1 parent 69d966d commit 1c043cd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
28 changes: 27 additions & 1 deletion .standard_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
---
ignore:
- 'lib/trino/client/*.rb'
- 'lib/trino/client/*.rb':
- Layout/EmptyLinesAroundModuleBody
- Layout/FirstHashElementIndentation
- Layout/SpaceAroundEqualsInParameterDefault
- Layout/SpaceInsideBlockBraces
- Layout/SpaceInsideBlockBraces
- Lint/AssignmentInCondition
- Lint/UselessAssignment
- Naming/VariableName
- Performance/RegexpMatch
- Performance/StringReplacement
- Style/ConditionalAssignment
- Style/HashConversion
- Style/HashSyntax
- Style/NilComparison
- Style/RedundantBegin
- Style/RedundantFileExtensionInRequire
- Style/RedundantInterpolation
- Style/RedundantReturn
- Style/RedundantSelf
- Style/SafeNavigation
- Style/Semicolon
- Style/StringLiterals
- Style/StringLiteralsInInterpolation
- Style/TernaryParentheses
- Style/TrailingCommaInHashLiteral

- 'modelgen/model_versions.rb': &modelgen_common
- Style/StringLiterals # TODO: Remove this later
- Layout/DotPosition # TODO: Remove this later
Expand Down
5 changes: 3 additions & 2 deletions lib/trino/client/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ def each_row_chunk(&block)
raise TrinoError, "Query #{@api.current_results.id} has no columns"
end

begin
loop do
if data = @api.current_results.data
block.call(data)
end
end while advance_and_raise
break unless advance_and_raise
end
end

def query_info
Expand Down
6 changes: 4 additions & 2 deletions lib/trino/client/statement_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def faraday_get_with_retry(uri, &block)
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
attempts = 0

begin
loop do
begin
response = @faraday.get(uri)
rescue Faraday::TimeoutError, Faraday::ConnectionFailed
Expand All @@ -218,7 +218,9 @@ def faraday_get_with_retry(uri, &block)

attempts += 1
sleep attempts * 0.1
end while (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) < @retry_timeout && !client_aborted?

break unless (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) < @retry_timeout && !client_aborted?
end

exception! TrinoHttpError.new(408, "Trino API error due to timeout")
end
Expand Down

0 comments on commit 1c043cd

Please sign in to comment.