diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-06-21 13:48:12 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-06-21 13:48:12 +0000 |
commit | 0430b7644101fc70ed4be6bf69ccf05b900f4cdf (patch) | |
tree | 3ea258c4da6e0f9c6e0f7523191fdb0a64a15c73 /lib/api | |
parent | 78ee24ba53a4a44d829613495ec0d5f1bbb5a9ee (diff) | |
download | gitlab-ce-0430b7644101fc70ed4be6bf69ccf05b900f4cdf.tar.gz |
Enable Style/DotPosition Rubocop :cop:
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/access_requests.rb | 4 | ||||
-rw-r--r-- | lib/api/branches.rb | 8 | ||||
-rw-r--r-- | lib/api/entities.rb | 6 | ||||
-rw-r--r-- | lib/api/notes.rb | 4 | ||||
-rw-r--r-- | lib/api/tags.rb | 16 | ||||
-rw-r--r-- | lib/api/users.rb | 26 | ||||
-rw-r--r-- | lib/api/v3/branches.rb | 8 | ||||
-rw-r--r-- | lib/api/v3/entities.rb | 6 | ||||
-rw-r--r-- | lib/api/v3/notes.rb | 4 | ||||
-rw-r--r-- | lib/api/v3/tags.rb | 4 | ||||
-rw-r--r-- | lib/api/v3/users.rb | 22 |
11 files changed, 54 insertions, 54 deletions
diff --git a/lib/api/access_requests.rb b/lib/api/access_requests.rb index a5c9f0b509c..c9b5f58c557 100644 --- a/lib/api/access_requests.rb +++ b/lib/api/access_requests.rb @@ -68,8 +68,8 @@ module API delete ":id/access_requests/:user_id" do source = find_source(source_type, params[:id]) - ::Members::DestroyService.new(source, current_user, params). - execute(:requesters) + ::Members::DestroyService.new(source, current_user, params) + .execute(:requesters) end end end diff --git a/lib/api/branches.rb b/lib/api/branches.rb index f35084a582a..3d816f8771d 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -102,8 +102,8 @@ module API post ":id/repository/branches" do authorize_push_project - result = CreateBranchService.new(user_project, current_user). - execute(params[:branch], params[:ref]) + result = CreateBranchService.new(user_project, current_user) + .execute(params[:branch], params[:ref]) if result[:status] == :success present result[:branch], @@ -121,8 +121,8 @@ module API delete ":id/repository/branches/:branch", requirements: { branch: /.+/ } do authorize_push_project - result = DeleteBranchService.new(user_project, current_user). - execute(params[:branch]) + result = DeleteBranchService.new(user_project, current_user) + .execute(params[:branch]) if result[:status] != :success render_api_error!(result[:message], result[:return_code]) diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 675bc52a983..aa91451c9f4 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -484,9 +484,9 @@ module API expose :job_events # Expose serialized properties expose :properties do |service, options| - field_names = service.fields. - select { |field| options[:include_passwords] || field[:type] != 'password' }. - map { |field| field[:name] } + field_names = service.fields + .select { |field| options[:include_passwords] || field[:type] != 'password' } + .map { |field| field[:name] } service.properties.slice(*field_names) end end diff --git a/lib/api/notes.rb b/lib/api/notes.rb index e281e3230fd..01ca62b593f 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -33,8 +33,8 @@ module API # paginate() only works with a relation. This could lead to a # mismatch between the pagination headers info and the actual notes # array returned, but this is really a edge-case. - paginate(noteable.notes). - reject { |n| n.cross_reference_not_visible_for?(current_user) } + paginate(noteable.notes) + .reject { |n| n.cross_reference_not_visible_for?(current_user) } present notes, with: Entities::Note else not_found!("Notes") diff --git a/lib/api/tags.rb b/lib/api/tags.rb index c7b1efe0bfa..633a858f8c7 100644 --- a/lib/api/tags.rb +++ b/lib/api/tags.rb @@ -44,8 +44,8 @@ module API post ':id/repository/tags' do authorize_push_project - result = ::Tags::CreateService.new(user_project, current_user). - execute(params[:tag_name], params[:ref], params[:message], params[:release_description]) + result = ::Tags::CreateService.new(user_project, current_user) + .execute(params[:tag_name], params[:ref], params[:message], params[:release_description]) if result[:status] == :success present result[:tag], @@ -63,8 +63,8 @@ module API delete ":id/repository/tags/:tag_name", requirements: { tag_name: /.+/ } do authorize_push_project - result = ::Tags::DestroyService.new(user_project, current_user). - execute(params[:tag_name]) + result = ::Tags::DestroyService.new(user_project, current_user) + .execute(params[:tag_name]) if result[:status] != :success render_api_error!(result[:message], result[:return_code]) @@ -81,8 +81,8 @@ module API post ':id/repository/tags/:tag_name/release', requirements: { tag_name: /.+/ } do authorize_push_project - result = CreateReleaseService.new(user_project, current_user). - execute(params[:tag_name], params[:description]) + result = CreateReleaseService.new(user_project, current_user) + .execute(params[:tag_name], params[:description]) if result[:status] == :success present result[:release], with: Entities::Release @@ -101,8 +101,8 @@ module API put ':id/repository/tags/:tag_name/release', requirements: { tag_name: /.+/ } do authorize_push_project - result = UpdateReleaseService.new(user_project, current_user). - execute(params[:tag_name], params[:description]) + result = UpdateReleaseService.new(user_project, current_user) + .execute(params[:tag_name], params[:description]) if result[:status] == :success present result[:release], with: Entities::Release diff --git a/lib/api/users.rb b/lib/api/users.rb index bfb69d6dc18..c10e3364382 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -103,13 +103,13 @@ module API if user.persisted? present user, with: Entities::UserPublic else - conflict!('Email has already been taken') if User. - where(email: user.email). - count > 0 + conflict!('Email has already been taken') if User + .where(email: user.email) + .count > 0 - conflict!('Username has already been taken') if User. - where(username: user.username). - count > 0 + conflict!('Username has already been taken') if User + .where(username: user.username) + .count > 0 render_validation_error!(user) end @@ -133,12 +133,12 @@ module API not_found!('User') unless user conflict!('Email has already been taken') if params[:email] && - User.where(email: params[:email]). - where.not(id: user.id).count > 0 + User.where(email: params[:email]) + .where.not(id: user.id).count > 0 conflict!('Username has already been taken') if params[:username] && - User.where(username: params[:username]). - where.not(id: user.id).count > 0 + User.where(username: params[:username]) + .where.not(id: user.id).count > 0 user_params = declared_params(include_missing: false) identity_attrs = user_params.slice(:provider, :extern_uid) @@ -517,9 +517,9 @@ module API get "activities" do authenticated_as_admin! - activities = User. - where(User.arel_table[:last_activity_on].gteq(params[:from])). - reorder(last_activity_on: :asc) + activities = User + .where(User.arel_table[:last_activity_on].gteq(params[:from])) + .reorder(last_activity_on: :asc) present paginate(activities), with: Entities::UserActivity end diff --git a/lib/api/v3/branches.rb b/lib/api/v3/branches.rb index 0a877b960f6..81b13249892 100644 --- a/lib/api/v3/branches.rb +++ b/lib/api/v3/branches.rb @@ -26,8 +26,8 @@ module API delete ":id/repository/branches/:branch", requirements: { branch: /.+/ } do authorize_push_project - result = DeleteBranchService.new(user_project, current_user). - execute(params[:branch]) + result = DeleteBranchService.new(user_project, current_user) + .execute(params[:branch]) if result[:status] == :success status(200) @@ -55,8 +55,8 @@ module API end post ":id/repository/branches" do authorize_push_project - result = CreateBranchService.new(user_project, current_user). - execute(params[:branch_name], params[:ref]) + result = CreateBranchService.new(user_project, current_user) + .execute(params[:branch_name], params[:ref]) if result[:status] == :success present result[:branch], diff --git a/lib/api/v3/entities.rb b/lib/api/v3/entities.rb index 7c5065dee90..c848f52723b 100644 --- a/lib/api/v3/entities.rb +++ b/lib/api/v3/entities.rb @@ -245,9 +245,9 @@ module API expose :job_events, as: :build_events # Expose serialized properties expose :properties do |service, options| - field_names = service.fields. - select { |field| options[:include_passwords] || field[:type] != 'password' }. - map { |field| field[:name] } + field_names = service.fields + .select { |field| options[:include_passwords] || field[:type] != 'password' } + .map { |field| field[:name] } service.properties.slice(*field_names) end end diff --git a/lib/api/v3/notes.rb b/lib/api/v3/notes.rb index 009ec5c6bbd..23fe95e42e4 100644 --- a/lib/api/v3/notes.rb +++ b/lib/api/v3/notes.rb @@ -34,8 +34,8 @@ module API # paginate() only works with a relation. This could lead to a # mismatch between the pagination headers info and the actual notes # array returned, but this is really a edge-case. - paginate(noteable.notes). - reject { |n| n.cross_reference_not_visible_for?(current_user) } + paginate(noteable.notes) + .reject { |n| n.cross_reference_not_visible_for?(current_user) } present notes, with: ::API::V3::Entities::Note else not_found!("Notes") diff --git a/lib/api/v3/tags.rb b/lib/api/v3/tags.rb index c2541de2f50..7e5875cd030 100644 --- a/lib/api/v3/tags.rb +++ b/lib/api/v3/tags.rb @@ -22,8 +22,8 @@ module API delete ":id/repository/tags/:tag_name", requirements: { tag_name: /.+/ } do authorize_push_project - result = ::Tags::DestroyService.new(user_project, current_user). - execute(params[:tag_name]) + result = ::Tags::DestroyService.new(user_project, current_user) + .execute(params[:tag_name]) if result[:status] == :success status(200) diff --git a/lib/api/v3/users.rb b/lib/api/v3/users.rb index f4cda3b2eba..37020019e07 100644 --- a/lib/api/v3/users.rb +++ b/lib/api/v3/users.rb @@ -50,13 +50,13 @@ module API if user.persisted? present user, with: ::API::Entities::UserPublic else - conflict!('Email has already been taken') if User. - where(email: user.email). - count > 0 + conflict!('Email has already been taken') if User + .where(email: user.email) + .count > 0 - conflict!('Username has already been taken') if User. - where(username: user.username). - count > 0 + conflict!('Username has already been taken') if User + .where(username: user.username) + .count > 0 render_validation_error!(user) end @@ -137,11 +137,11 @@ module API user = User.find_by(id: params[:id]) not_found!('User') unless user - events = user.events. - merge(ProjectsFinder.new(current_user: current_user).execute). - references(:project). - with_associations. - recent + events = user.events + .merge(ProjectsFinder.new(current_user: current_user).execute) + .references(:project) + .with_associations + .recent present paginate(events), with: ::API::V3::Entities::Event end |