Skip to content

Commit

Permalink
rubocop up
Browse files Browse the repository at this point in the history
  • Loading branch information
davvd committed Jun 27, 2023
1 parent 4826d68 commit bfc7e72
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 35 deletions.
4 changes: 3 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.5
SuggestExtensions: false
NewCops: enable

Layout/EmptyLineAfterGuardClause:
Enabled: false
Expand All @@ -18,7 +20,7 @@ Metrics/ClassLength:
Max: 180
Metrics/ParameterLists:
Max: 7
Layout/AlignParameters:
Layout/ParameterAlignment:
Enabled: false
Metrics/CyclomaticComplexity:
Max: 20
Expand Down
32 changes: 14 additions & 18 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# encoding: utf-8
# frozen_string_literal: true

#
# Copyright (c) 2018-2023 Yegor Bugayenko
#
Expand All @@ -20,21 +21,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

if Gem.win_platform? then
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter
]
SimpleCov.start do
add_filter "/test/"
add_filter "/features/"
end
else
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[SimpleCov::Formatter::HTMLFormatter]
)
SimpleCov.start do
add_filter "/test/"
add_filter "/features/"
# minimum_coverage 30
end
SimpleCov.formatter = if Gem.win_platform?
SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter
]
else
SimpleCov::Formatter::MultiFormatter.new(
[SimpleCov::Formatter::HTMLFormatter]
)
end
SimpleCov.start do
add_filter '/test/'
add_filter '/features/'
end
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ gem 'minitest-hooks', '1.5.0', require: false
gem 'rake-compiler', '1.2.3', require: false
gem 'rdoc', '4.3.0', require: false
gem 'rspec-rails', '6.0.3', require: false
gem 'rubocop', '0.62.0', require: false
gem 'rubocop-rspec', '1.31.0', require: false
gem 'rubocop', '1.53.1', require: false
gem 'rubocop-rspec', '2.22.0', require: false
gem 'simplecov', '0.22.0', require: false
gem 'webmock', '3.18.1', require: false
13 changes: 6 additions & 7 deletions lib/zold/wts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,12 @@ def usd_rate
# The method returns an array of Zold::Txn objects.
def find(query)
start = Time.now
tail = query.map do |k, v|
"#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"
end.join('&')
http = clean(
Typhoeus::Request.get(
'https://wts.zold.io/find?' + query.map do |k, v|
"#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"
end.join('&'),
"https://wts.zold.io/find?#{tail}",
headers: headers
)
)
Expand All @@ -183,11 +184,9 @@ def find(query)
def wait(job, time: 5 * 60)
start = Time.now
loop do
if Time.now - start > time
raise "Can't wait any longer for the job #{job} to complete"
end
raise "Can't wait any longer for the job #{job} to complete" if Time.now - start > time
http = Typhoeus::Request.get(
'https://wts.zold.io/job?id=' + job,
"https://wts.zold.io/job?id=#{job}",
headers: headers
)
raise "Job #{job} not found on the server" if http.code == 404
Expand Down
2 changes: 1 addition & 1 deletion test/test__helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

STDOUT.sync = true
$stdout.sync = true

require 'simplecov'
SimpleCov.start
Expand Down
8 changes: 2 additions & 6 deletions zold-ruby-sdk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@

require 'English'
Gem::Specification.new do |s|
s.specification_version = 2 if s.respond_to? :specification_version=
if s.respond_to? :required_rubygems_version=
s.required_rubygems_version = Gem::Requirement.new('>= 0')
end
s.rubygems_version = '2.2'
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
s.required_ruby_version = '>=2.5'
s.name = 'zold-ruby-sdk'
s.version = '0.0.0'
Expand All @@ -38,10 +34,10 @@ Gem::Specification.new do |s|
s.homepage = 'http://github.com/zold-io/zold-ruby-sdk'
s.files = `git ls-files`.split($RS)
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
s.test_files = s.files.grep(%r{^(test|features)/})
s.rdoc_options = ['--charset=UTF-8']
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
s.add_runtime_dependency 'loog', '~>0.2'
s.add_runtime_dependency 'typhoeus', '1.4.0'
s.add_runtime_dependency 'zold', '~>0.31'
s.metadata['rubygems_mfa_required'] = 'true'
end

0 comments on commit bfc7e72

Please sign in to comment.