diff options
author | Toon Claes <toon@gitlab.com> | 2019-02-28 19:57:34 +0100 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2019-02-28 19:57:34 +0100 |
commit | 62d7990b9bb30cf33ed87017c5c633d1cccc75c2 (patch) | |
tree | c3e1b69c58a412ba1c6f50a0337a23d9f9d6e1a4 /lib/api/internal.rb | |
parent | f6453eca992a9c142268e78ac782cef98110d183 (diff) | |
download | gitlab-ce-tc-standard-gem.tar.gz |
Ran standardrb --fix on the whole codebasetc-standard-gem
Inspired by https://twitter.com/searls/status/1101137953743613952 I
decided to try https://github.com/testdouble/standard on our codebase.
It's opinionated, but at least it's a _standard_.
Diffstat (limited to 'lib/api/internal.rb')
-rw-r--r-- | lib/api/internal.rb | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 70b32f7d758..88183d7f10a 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -8,16 +8,16 @@ module API helpers ::API::Helpers::InternalHelpers helpers ::Gitlab::Identifier - UNKNOWN_CHECK_RESULT_ERROR = 'Unknown check result'.freeze + UNKNOWN_CHECK_RESULT_ERROR = "Unknown check result" helpers do def response_with_status(code: 200, success: true, message: nil, **extra_options) status code - { status: success, message: message }.merge(extra_options).compact + {status: success, message: message}.merge(extra_options).compact end end - namespace 'internal' do + namespace "internal" do # Check if git command is allowed for project # # Params: @@ -84,9 +84,9 @@ module API # This repository_path is a bogus value but gitlab-shell still requires # its presence. https://gitlab.com/gitlab-org/gitlab-shell/issues/135 - repository_path: '/', + repository_path: "/", - gitaly: gitaly_payload(params[:action]) + gitaly: gitaly_payload(params[:action]), } # Custom option for git-receive-pack command @@ -131,9 +131,9 @@ module API # # rubocop: disable CodeReuse/ActiveRecord get "/authorized_keys" do - fingerprint = params.fetch(:fingerprint) do + fingerprint = params.fetch(:fingerprint) { Gitlab::InsecureKeyFingerprint.new(params.fetch(:key)).fingerprint - end + } key = Key.find_by(fingerprint: fingerprint) not_found!("Key") if key.nil? present key, with: Entities::SSHKey @@ -163,7 +163,7 @@ module API api_version: API.version, gitlab_version: Gitlab::VERSION, gitlab_rev: Gitlab.revision, - redis: redis_ping + redis: redis_ping, } end @@ -184,7 +184,7 @@ module API end # rubocop: disable CodeReuse/ActiveRecord - post '/two_factor_recovery_codes' do + post "/two_factor_recovery_codes" do status 200 if params[:key_id] @@ -193,28 +193,28 @@ module API if key key.update_last_used_at else - break { 'success' => false, 'message' => 'Could not find the given key' } + break {"success" => false, "message" => "Could not find the given key"} end if key.is_a?(DeployKey) - break { success: false, message: 'Deploy keys cannot be used to retrieve recovery codes' } + break {success: false, message: "Deploy keys cannot be used to retrieve recovery codes"} end user = key.user unless user - break { success: false, message: 'Could not find a user for the given key' } + break {success: false, message: "Could not find a user for the given key"} end elsif params[:user_id] user = User.find_by(id: params[:user_id]) unless user - break { success: false, message: 'Could not find the given user' } + break {success: false, message: "Could not find the given user"} end end unless user.two_factor_enabled? - break { success: false, message: 'Two-factor authentication is not enabled for this user' } + break {success: false, message: "Two-factor authentication is not enabled for this user"} end codes = nil @@ -223,16 +223,16 @@ module API codes = user.generate_otp_backup_codes! end - { success: true, recovery_codes: codes } + {success: true, recovery_codes: codes} end # rubocop: enable CodeReuse/ActiveRecord - post '/pre_receive' do + post "/pre_receive" do status 200 reference_counter_increased = Gitlab::ReferenceCounter.new(params[:gl_repository]).increase - { reference_counter_increased: reference_counter_increased } + {reference_counter_increased: reference_counter_increased} end post "/notify_post_receive" do @@ -249,7 +249,7 @@ module API # end end - post '/post_receive' do + post "/post_receive" do status 200 PostReceive.perform_async(params[:gl_repository], params[:identifier], @@ -260,7 +260,7 @@ module API output = { merge_request_urls: merge_request_urls, broadcast_message: broadcast_message, - reference_counter_decreased: reference_counter_decreased + reference_counter_decreased: reference_counter_decreased, } project = Gitlab::GlRepository.parse(params[:gl_repository]).first |