summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2017-02-28 20:25:58 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2017-03-02 17:45:46 +0100
commit1bbf2c2cd16140aa95bbf93368209b16795172bd (patch)
tree98d190774e1112843bac2c637e47bc61b4c91621
parentf7d352341eb4a0eea98889275cbbeb46049d21a2 (diff)
downloadgitlab-ce-1bbf2c2cd16140aa95bbf93368209b16795172bd.tar.gz
Fix rubocop offenses
-rw-r--r--lib/api/helpers/runner.rb4
-rw-r--r--lib/api/runner.rb16
-rw-r--r--lib/gitlab/ci/build/response/step.rb6
-rw-r--r--spec/requests/api/runner_spec.rb8
4 files changed, 17 insertions, 17 deletions
diff --git a/lib/api/helpers/runner.rb b/lib/api/helpers/runner.rb
index 97255cc8c81..ec2bcaed929 100644
--- a/lib/api/helpers/runner.rb
+++ b/lib/api/helpers/runner.rb
@@ -1,7 +1,7 @@
module API
module Helpers
module Runner
- JOB_TOKEN_HEADER = 'HTTP_JOB_TOKEN'
+ JOB_TOKEN_HEADER = 'HTTP_JOB_TOKEN'.freeze
JOB_TOKEN_PARAM = :token
UPDATE_RUNNER_EVERY = 10 * 60
@@ -42,7 +42,7 @@ module API
end
def job_not_found!
- if headers['User-Agent'].to_s.match(/gitlab(-ci-multi)?-runner \d+\.\d+\.\d+(~beta\.\d+\.g[0-9a-f]+)? /)
+ if headers['User-Agent'].to_s =~ /gitlab(-ci-multi)?-runner \d+\.\d+\.\d+(~beta\.\d+\.g[0-9a-f]+)? /
no_content!
else
not_found!
diff --git a/lib/api/runner.rb b/lib/api/runner.rb
index 4cbc2fb08c2..23db32c9b1f 100644
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -94,7 +94,7 @@ module API
end
params do
requires :token, type: String, desc: %q(Runners's authentication token)
- requires :id, type: Fixnum, desc: %q(Job's ID)
+ requires :id, type: Integer, desc: %q(Job's ID)
optional :trace, type: String, desc: %q(Job's full trace)
optional :state, type: String, desc: %q(Job's status: success, failed)
end
@@ -122,7 +122,7 @@ module API
[416, 'Range not satisfiable']]
end
params do
- requires :id, type: Fixnum, desc: %q(Job's ID)
+ requires :id, type: Integer, desc: %q(Job's ID)
optional :token, type: String, desc: %q(Job's authentication token)
end
patch '/:id/trace' do
@@ -152,9 +152,9 @@ module API
[413, 'File too large']]
end
params do
- requires :id, type: Fixnum, desc: %q(Job's ID)
+ requires :id, type: Integer, desc: %q(Job's ID)
optional :token, type: String, desc: %q(Job's authentication token)
- optional :filesize, type: Fixnum, desc: %q(ARtifacts filesize)
+ optional :filesize, type: Integer, desc: %q(Artifacts filesize)
end
post '/:id/artifacts/authorize' do
not_allowed! unless Gitlab.config.artifacts.enabled
@@ -183,7 +183,7 @@ module API
[413, 'File too large']]
end
params do
- requires :id, type: Fixnum, desc: %q(Job's ID)
+ requires :id, type: Integer, desc: %q(Job's ID)
optional :token, type: String, desc: %q(Job's authentication token)
optional :expire_in, type: String, desc: %q(Specify when artifacts should expire)
optional 'file', type: File, desc: %q(Artifact's file)
@@ -211,9 +211,7 @@ module API
job.artifacts_file = artifacts
job.artifacts_metadata = metadata
job.artifacts_expire_in = params['expire_in'] ||
- Gitlab::CurrentSettings
- .current_application_settings
- .default_artifacts_expire_in
+ Gitlab::CurrentSettings.current_application_settings.default_artifacts_expire_in
if job.save
present job, with: Entities::JobRequest::Response
@@ -228,7 +226,7 @@ module API
[404, 'Artifact not found']]
end
params do
- requires :id, type: Fixnum, desc: %q(Job's ID)
+ requires :id, type: Integer, desc: %q(Job's ID)
optional :token, type: String, desc: %q(Job's authentication token)
end
get '/:id/artifacts' do
diff --git a/lib/gitlab/ci/build/response/step.rb b/lib/gitlab/ci/build/response/step.rb
index 9b359057b30..98c531c1d99 100644
--- a/lib/gitlab/ci/build/response/step.rb
+++ b/lib/gitlab/ci/build/response/step.rb
@@ -3,9 +3,9 @@ module Gitlab
module Build
module Response
class Step
- CONDITION_ON_FAILURE = 'on_failure'
- CONDITION_ON_SUCCESS = 'on_success'
- CONDITION_ALWAYS = 'always'
+ CONDITION_ON_FAILURE = 'on_failure'.freeze
+ CONDITION_ON_SUCCESS = 'on_success'.freeze
+ CONDITION_ALWAYS = 'always'.freeze
attr_reader :name, :script, :when, :allow_failure, :timeout
diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb
index 37045610cc2..f19a9bf354c 100644
--- a/spec/requests/api/runner_spec.rb
+++ b/spec/requests/api/runner_spec.rb
@@ -281,7 +281,7 @@ describe API::Runner do
expect(json_response['image']).to include({ 'name' => 'ruby:2.1' })
expect(json_response['services']).to include({ 'name' => 'postgres' })
expect(json_response['steps']).to include({ 'name' => 'after_script',
- 'script' => ['ls', 'date'],
+ 'script' => %w(ls date),
'timeout' => job.timeout,
'when' => 'always',
'allow_failure' => true })
@@ -889,9 +889,11 @@ describe API::Runner do
end
def upload_artifacts(file, headers = {}, accelerated = true)
- params = accelerated ?
- { 'file.path' => file.path, 'file.name' => file.original_filename } :
+ params = if accelerated
+ { 'file.path' => file.path, 'file.name' => file.original_filename }
+ else
{ 'file' => file }
+ end
post api("/jobs/#{job.id}/artifacts"), params, headers
end
end