Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linter: Enable linter on lib #98

Merged
merged 6 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why the target files are expanded.

I think it's enough to add the rules to the current target.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

revereted

- 'lib/trino/client/*.rb':
exoego marked this conversation as resolved.
Show resolved Hide resolved
- 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