Bekicot has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/368608 )
Change subject: Fix Rubocop Offenses Fix rubocop offenses generated by rubocop.
Ommit 1 offense on `mediawiki_api.gemspec:14` beacause it would reduce the
readability
......................................................................
Fix Rubocop Offenses
Fix rubocop offenses generated by rubocop. Ommit 1 offense on
`mediawiki_api.gemspec:14` beacause it would reduce the readability
Change-Id: I1f7221af1fbf4677e5104c22b0c722f5dd27b8d5
---
M Rakefile
M lib/mediawiki_api/client.rb
M mediawiki_api.gemspec
M spec/client_spec.rb
M spec/response_spec.rb
5 files changed, 11 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/ruby/api
refs/changes/08/368608/1
diff --git a/Rakefile b/Rakefile
index 3a24c05..8fa0645 100644
--- a/Rakefile
+++ b/Rakefile
@@ -13,7 +13,7 @@
task default: [:test]
desc 'Run all build/tests commands (CI entry point)'
-task test: [:build, :rubocop, :spec, :yard]
+task test: %i[build rubocop spec yard]
desc 'Generate all documentations'
task doc: [:yard]
diff --git a/lib/mediawiki_api/client.rb b/lib/mediawiki_api/client.rb
index 28ec7bc..abd7627 100644
--- a/lib/mediawiki_api/client.rb
+++ b/lib/mediawiki_api/client.rb
@@ -35,12 +35,10 @@
def action(name, params = {})
raw_action(name, params)
rescue ApiError => e
- if e.code == 'badtoken'
- @tokens.clear # ensure fresh token on re-try
- raw_action(name, params) # no rescue this time; only re-try once.
- else
- raise # otherwise, propagate the exception
- end
+ # propagate the exception
+ raise unless e.code == 'badtoken'
+ @tokens.clear # ensure fresh token on re-try
+ raw_action(name, params) # no rescue this time; only re-try once.
end
def create_account(username, password)
@@ -204,7 +202,7 @@
def send_request(method, params, envelope)
response = @conn.send(method, '', params)
-
+ puts params
raise HttpError, response.status if response.status >= 400
if response.headers.include?('mediawiki-api-error')
diff --git a/mediawiki_api.gemspec b/mediawiki_api.gemspec
index a07b747..48b9607 100644
--- a/mediawiki_api.gemspec
+++ b/mediawiki_api.gemspec
@@ -1,4 +1,5 @@
# coding: utf-8
+
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'mediawiki_api/version'
diff --git a/spec/client_spec.rb b/spec/client_spec.rb
index 3681820..17df3b5 100644
--- a/spec/client_spec.rb
+++ b/spec/client_spec.rb
@@ -91,7 +91,7 @@
end
context 'array parameters' do
- let(:params) { { foo: %w(one two) } }
+ let(:params) { { foo: %w[one two] } }
before do
@request = stub_action_request(action, foo:
'one|two').to_return(response)
diff --git a/spec/response_spec.rb b/spec/response_spec.rb
index f431497..c52bbd4 100644
--- a/spec/response_spec.rb
+++ b/spec/response_spec.rb
@@ -28,14 +28,14 @@
end
context 'and a multi-level envelope' do
- let(:envelope) { %w(query result) }
+ let(:envelope) { %w[query result] }
let(:nested_object) { response_object['query']['result'] }
it { is_expected.to eq(nested_object) }
end
context "and a multi-level envelope that doesn't completely match" do
- let(:envelope) { %w(query something) }
+ let(:envelope) { %w[query something] }
let(:partially_nested_object) { response_object['query'] }
it { is_expected.to eq(partially_nested_object) }
@@ -46,7 +46,7 @@
let(:body) { '[ "something" ]' }
context 'with any expected envelope' do
- let(:envelope) { %w(what ever) }
+ let(:envelope) { %w[what ever] }
it { is_expected.to eq(response_object) }
end
--
To view, visit https://gerrit.wikimedia.org/r/368608
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f7221af1fbf4677e5104c22b0c722f5dd27b8d5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/ruby/api
Gerrit-Branch: master
Gerrit-Owner: Bekicot <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits