diff --git a/.rubocop.yml b/.rubocop.yml index c3f3d7bca66ed9f5f3708445061ea387341eda40..319efe7e0dc4ac72b7ff543cea76ce2d4dde98cb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -74,7 +74,7 @@ Style/BlockComments: Style/BlockEndNewline: Description: 'Put end statement of multiline block on its own line.' - Enabled: false + Enabled: true Style/Blocks: Description: >- @@ -82,7 +82,7 @@ Style/Blocks: always ugly). Prefer {...} over do...end for single-line blocks. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks' - Enabled: false + Enabled: true Style/BracesAroundHashParameters: Description: 'Enforce braces style around hash parameters.' diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb index be3d053efca6c1d9958841cc060fb5a83e35126f..cb20bf0720d4c9a0440ea55f63e406bc84ae880f 100644 --- a/lib/api/api_guard.rb +++ b/lib/api/api_guard.rb @@ -120,7 +120,7 @@ module APIGuard end def oauth2_bearer_token_error_handler - Proc.new {|e| + Proc.new do |e| response = case e when MissingTokenError Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new @@ -150,7 +150,7 @@ module APIGuard end response.finish - } + end end end diff --git a/lib/api/internal.rb b/lib/api/internal.rb index a999cff09c045da463c21340872c7a21728943f9..7a89a26facc8d8f974b12c19bdda5811de3f51d8 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -1,9 +1,7 @@ module API # Internal access API class Internal < Grape::API - before { - authenticate_by_gitlab_shell_token! - } + before { authenticate_by_gitlab_shell_token! } namespace 'internal' do # Check if git command is allowed to project diff --git a/lib/api/namespaces.rb b/lib/api/namespaces.rb index f9f2ed90ccc357ca49d1e0a436411f73b0888463..b90ed6af5fbe6e32f92a65e57df72f3a34d49c22 100644 --- a/lib/api/namespaces.rb +++ b/lib/api/namespaces.rb @@ -1,10 +1,10 @@ module API # namespaces API class Namespaces < Grape::API - before { + before do authenticate! authenticated_as_admin! - } + end resource :namespaces do # Get a namespaces list diff --git a/lib/api/system_hooks.rb b/lib/api/system_hooks.rb index 3e239c5afe773502151d31ae109f31fd6934abc6..518964db50d3739a5472771b9f1f3a8e0ab9b1e4 100644 --- a/lib/api/system_hooks.rb +++ b/lib/api/system_hooks.rb @@ -1,10 +1,10 @@ module API # Hooks API class SystemHooks < Grape::API - before { + before do authenticate! authenticated_as_admin! - } + end resource :hooks do # Get the list of system hooks