Enable Style/MultilineOperationIndentation in Rubocop, fixes #25741
This commit is contained in:
parent
b1120fc3e7
commit
170efaaba2
|
@ -292,7 +292,8 @@ Style/MultilineMethodDefinitionBraceLayout:
|
|||
|
||||
# Checks indentation of binary operations that span more than one line.
|
||||
Style/MultilineOperationIndentation:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
EnforcedStyle: indented
|
||||
|
||||
# Avoid multi-line `? :` (the ternary operator), use if/unless instead.
|
||||
Style/MultilineTernaryOperator:
|
||||
|
|
|
@ -26,7 +26,7 @@ class JwtController < ApplicationController
|
|||
@authentication_result = Gitlab::Auth.find_for_git_client(login, password, project: nil, ip: request.ip)
|
||||
|
||||
render_unauthorized unless @authentication_result.success? &&
|
||||
(@authentication_result.actor.nil? || @authentication_result.actor.is_a?(User))
|
||||
(@authentication_result.actor.nil? || @authentication_result.actor.is_a?(User))
|
||||
end
|
||||
rescue Gitlab::Auth::MissingPersonalTokenError
|
||||
render_missing_personal_token
|
||||
|
|
|
@ -114,7 +114,7 @@ class SessionsController < Devise::SessionsController
|
|||
|
||||
def valid_otp_attempt?(user)
|
||||
user.validate_and_consume_otp!(user_params[:otp_attempt]) ||
|
||||
user.invalidate_otp_backup_code!(user_params[:otp_attempt])
|
||||
user.invalidate_otp_backup_code!(user_params[:otp_attempt])
|
||||
end
|
||||
|
||||
def log_audit_event(user, options = {})
|
||||
|
|
|
@ -7,12 +7,12 @@ module FormHelper
|
|||
|
||||
content_tag(:div, class: 'alert alert-danger', id: 'error_explanation') do
|
||||
content_tag(:h4, headline) <<
|
||||
content_tag(:ul) do
|
||||
model.errors.full_messages.
|
||||
map { |msg| content_tag(:li, msg) }.
|
||||
join.
|
||||
html_safe
|
||||
end
|
||||
content_tag(:ul) do
|
||||
model.errors.full_messages.
|
||||
map { |msg| content_tag(:li, msg) }.
|
||||
join.
|
||||
html_safe
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,12 +7,12 @@ module NavHelper
|
|||
|
||||
def page_gutter_class
|
||||
if current_path?('merge_requests#show') ||
|
||||
current_path?('merge_requests#diffs') ||
|
||||
current_path?('merge_requests#commits') ||
|
||||
current_path?('merge_requests#builds') ||
|
||||
current_path?('merge_requests#conflicts') ||
|
||||
current_path?('merge_requests#pipelines') ||
|
||||
current_path?('issues#show')
|
||||
current_path?('merge_requests#diffs') ||
|
||||
current_path?('merge_requests#commits') ||
|
||||
current_path?('merge_requests#builds') ||
|
||||
current_path?('merge_requests#conflicts') ||
|
||||
current_path?('merge_requests#pipelines') ||
|
||||
current_path?('issues#show')
|
||||
if cookies[:collapsed_gutter] == 'true'
|
||||
"page-gutter right-sidebar-collapsed"
|
||||
else
|
||||
|
@ -21,9 +21,9 @@ module NavHelper
|
|||
elsif current_path?('builds#show')
|
||||
"page-gutter build-sidebar right-sidebar-expanded"
|
||||
elsif current_path?('wikis#show') ||
|
||||
current_path?('wikis#edit') ||
|
||||
current_path?('wikis#history') ||
|
||||
current_path?('wikis#git_access')
|
||||
current_path?('wikis#edit') ||
|
||||
current_path?('wikis#history') ||
|
||||
current_path?('wikis#git_access')
|
||||
"page-gutter wiki-sidebar right-sidebar-expanded"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -106,9 +106,9 @@ module TabHelper
|
|||
|
||||
def branches_tab_class
|
||||
if current_controller?(:protected_branches) ||
|
||||
current_controller?(:branches) ||
|
||||
current_page?(namespace_project_repository_path(@project.namespace,
|
||||
@project))
|
||||
current_controller?(:branches) ||
|
||||
current_page?(namespace_project_repository_path(@project.namespace,
|
||||
@project))
|
||||
'active'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -89,8 +89,8 @@ class Member < ActiveRecord::Base
|
|||
member =
|
||||
if user.is_a?(User)
|
||||
source.members.find_by(user_id: user.id) ||
|
||||
source.requesters.find_by(user_id: user.id) ||
|
||||
source.members.build(user_id: user.id)
|
||||
source.requesters.find_by(user_id: user.id) ||
|
||||
source.members.build(user_id: user.id)
|
||||
else
|
||||
source.members.build(invite_email: user)
|
||||
end
|
||||
|
|
|
@ -161,8 +161,8 @@ module Network
|
|||
def is_overlap?(range, overlap_space)
|
||||
range.each do |i|
|
||||
if i != range.first &&
|
||||
i != range.last &&
|
||||
@commits[i].spaces.include?(overlap_space)
|
||||
i != range.last &&
|
||||
@commits[i].spaces.include?(overlap_space)
|
||||
|
||||
return true
|
||||
end
|
||||
|
|
|
@ -85,8 +85,8 @@ class IssueTrackerService < Service
|
|||
|
||||
def enabled_in_gitlab_config
|
||||
Gitlab.config.issues_tracker &&
|
||||
Gitlab.config.issues_tracker.values.any? &&
|
||||
issues_tracker
|
||||
Gitlab.config.issues_tracker.values.any? &&
|
||||
issues_tracker
|
||||
end
|
||||
|
||||
def issues_tracker
|
||||
|
|
|
@ -390,7 +390,7 @@ class User < ActiveRecord::Base
|
|||
def namespace_uniq
|
||||
# Return early if username already failed the first uniqueness validation
|
||||
return if errors.key?(:username) &&
|
||||
errors[:username].include?('has already been taken')
|
||||
errors[:username].include?('has already been taken')
|
||||
|
||||
existing_namespace = Namespace.by_path(username)
|
||||
if existing_namespace && existing_namespace != namespace
|
||||
|
|
|
@ -12,7 +12,7 @@ class NotePolicy < BasePolicy
|
|||
end
|
||||
|
||||
if @subject.for_merge_request? &&
|
||||
@subject.noteable.author == @user
|
||||
@subject.noteable.author == @user
|
||||
can! :resolve_note
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ class ProjectPolicy < BasePolicy
|
|||
team_access!(user)
|
||||
|
||||
owner = project.owner == user ||
|
||||
(project.group && project.group.has_owner?(user))
|
||||
(project.group && project.group.has_owner?(user))
|
||||
|
||||
owner_access! if user.admin? || owner
|
||||
team_member_owner_access! if owner
|
||||
|
@ -13,7 +13,7 @@ class ProjectPolicy < BasePolicy
|
|||
public_access!
|
||||
|
||||
if project.request_access_enabled &&
|
||||
!(owner || user.admin? || project.team.member?(user) || project_group_member?(user))
|
||||
!(owner || user.admin? || project.team.member?(user) || project_group_member?(user))
|
||||
can! :request_access
|
||||
end
|
||||
end
|
||||
|
@ -244,10 +244,10 @@ class ProjectPolicy < BasePolicy
|
|||
|
||||
def project_group_member?(user)
|
||||
project.group &&
|
||||
(
|
||||
project.group.members.exists?(user_id: user.id) ||
|
||||
project.group.requesters.exists?(user_id: user.id)
|
||||
)
|
||||
(
|
||||
project.group.members.exists?(user_id: user.id) ||
|
||||
project.group.requesters.exists?(user_id: user.id)
|
||||
)
|
||||
end
|
||||
|
||||
def named_abilities(name)
|
||||
|
|
|
@ -5,7 +5,7 @@ module Groups
|
|||
new_visibility = params[:visibility_level]
|
||||
if new_visibility && new_visibility.to_i != group.visibility_level
|
||||
unless can?(current_user, :change_visibility_level, group) &&
|
||||
Gitlab::VisibilityLevel.allowed_for?(current_user, new_visibility)
|
||||
Gitlab::VisibilityLevel.allowed_for?(current_user, new_visibility)
|
||||
|
||||
deny_visibility_level(group, new_visibility)
|
||||
return group
|
||||
|
|
|
@ -10,7 +10,7 @@ module Issues
|
|||
end
|
||||
|
||||
if issue.previous_changes.include?('title') ||
|
||||
issue.previous_changes.include?('description')
|
||||
issue.previous_changes.include?('description')
|
||||
todo_service.update_issue(issue, current_user)
|
||||
end
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ module MergeRequests
|
|||
end
|
||||
|
||||
if merge_request.source_project == merge_request.target_project &&
|
||||
merge_request.target_branch == merge_request.source_branch
|
||||
merge_request.target_branch == merge_request.source_branch
|
||||
|
||||
messages << 'You must select different branches'
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ module MergeRequests
|
|||
end
|
||||
|
||||
if merge_request.previous_changes.include?('title') ||
|
||||
merge_request.previous_changes.include?('description')
|
||||
merge_request.previous_changes.include?('description')
|
||||
todo_service.update_merge_request(merge_request, current_user)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Projects
|
|||
|
||||
if new_visibility && new_visibility.to_i != project.visibility_level
|
||||
unless can?(current_user, :change_visibility_level, project) &&
|
||||
Gitlab::VisibilityLevel.allowed_for?(current_user, new_visibility)
|
||||
Gitlab::VisibilityLevel.allowed_for?(current_user, new_visibility)
|
||||
|
||||
deny_visibility_level(project, new_visibility)
|
||||
return project
|
||||
|
|
|
@ -34,7 +34,7 @@ Sidekiq.configure_server do |config|
|
|||
# Database pool should be at least `sidekiq_concurrency` + 2
|
||||
# For more info, see: https://github.com/mperham/sidekiq/blob/master/4.0-Upgrade.md
|
||||
config = ActiveRecord::Base.configurations[Rails.env] ||
|
||||
Rails.application.config.database_configuration[Rails.env]
|
||||
Rails.application.config.database_configuration[Rails.env]
|
||||
config['pool'] = Sidekiq.options[:concurrency] + 2
|
||||
ActiveRecord::Base.establish_connection(config)
|
||||
Rails.logger.debug("Connection Pool size for Sidekiq Server is now: #{ActiveRecord::Base.connection.pool.instance_variable_get('@size')}")
|
||||
|
|
|
@ -69,7 +69,7 @@ module Gitlab
|
|||
# This one might be controversial but so many reply lines have years, times and end with a colon.
|
||||
# Let's try it and see how well it works.
|
||||
break if (l =~ /\d{4}/ && l =~ /\d:\d\d/ && l =~ /\:$/) ||
|
||||
(l =~ /On \w+ \d+,? \d+,?.*wrote:/)
|
||||
(l =~ /On \w+ \d+,? \d+,?.*wrote:/)
|
||||
|
||||
# Headers on subsequent lines
|
||||
break if (0..2).all? { |off| lines[idx + off] =~ REPLYING_HEADER_REGEX }
|
||||
|
|
|
@ -29,7 +29,7 @@ describe Gitlab::Gfm::ReferenceRewriter do
|
|||
context 'description with ignored elements' do
|
||||
let(:text) do
|
||||
"Hi. This references #1, but not `#2`\n" +
|
||||
'<pre>and not !1</pre>'
|
||||
'<pre>and not !1</pre>'
|
||||
end
|
||||
|
||||
it { is_expected.to include issue_first.to_reference(new_project) }
|
||||
|
|
|
@ -167,7 +167,7 @@ describe API::Projects, api: true do
|
|||
expect(json_response).to satisfy do |response|
|
||||
response.one? do |entry|
|
||||
entry.has_key?('permissions') &&
|
||||
entry['name'] == project.name &&
|
||||
entry['name'] == project.name &&
|
||||
entry['owner']['username'] == user.username
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue