Enable Style/RedundantParentheses rubocop cop

See #17478
This commit is contained in:
Grzegorz Bizon 2016-05-30 15:07:18 +02:00
parent 43c35b0f20
commit c370dce01c
5 changed files with 6 additions and 7 deletions

View File

@ -486,10 +486,9 @@ Style/RedundantException:
Style/RedundantFreeze: Style/RedundantFreeze:
Enabled: false Enabled: false
# TODO: Enable RedundantParentheses Cop.
# Checks for parentheses that seem not to serve any purpose. # Checks for parentheses that seem not to serve any purpose.
Style/RedundantParentheses: Style/RedundantParentheses:
Enabled: false Enabled: true
# Don't use return where it's not required. # Don't use return where it's not required.
Style/RedundantReturn: Style/RedundantReturn:

View File

@ -39,11 +39,11 @@ module DiffHelper
end end
def unfold_bottom_class(bottom) def unfold_bottom_class(bottom)
(bottom) ? 'js-unfold-bottom' : '' bottom ? 'js-unfold-bottom' : ''
end end
def unfold_class(unfold) def unfold_class(unfold)
(unfold) ? 'unfold js-unfold' : '' unfold ? 'unfold js-unfold' : ''
end end
def diff_line_content(line, line_type = nil) def diff_line_content(line, line_type = nil)

View File

@ -23,6 +23,6 @@ else
secure: Gitlab.config.gitlab.https, secure: Gitlab.config.gitlab.https,
httponly: true, httponly: true,
expires_in: Settings.gitlab['session_expire_delay'] * 60, expires_in: Settings.gitlab['session_expire_delay'] * 60,
path: (Rails.application.config.relative_url_root.nil?) ? '/' : Gitlab::Application.config.relative_url_root path: Rails.application.config.relative_url_root.nil? ? '/' : Gitlab::Application.config.relative_url_root
) )
end end

View File

@ -76,7 +76,7 @@ module API
required_attributes! [:email, :password, :name, :username] required_attributes! [:email, :password, :name, :username]
attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :bio, :location, :can_create_group, :admin, :confirm, :external] attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :bio, :location, :can_create_group, :admin, :confirm, :external]
admin = attrs.delete(:admin) admin = attrs.delete(:admin)
confirm = !(attrs.delete(:confirm) =~ (/(false|f|no|0)$/i)) confirm = !(attrs.delete(:confirm) =~ /(false|f|no|0)$/i)
user = User.build_user(attrs) user = User.build_user(attrs)
user.admin = admin unless admin.nil? user.admin = admin unless admin.nil?
user.skip_confirmation! unless confirm user.skip_confirmation! unless confirm

View File

@ -63,7 +63,7 @@ describe Projects::MergeRequestsController do
id: merge_request.iid, id: merge_request.iid,
format: format) format: format)
expect(response.body).to eq((merge_request.send(:"to_#{format}")).to_s) expect(response.body).to eq(merge_request.send(:"to_#{format}").to_s)
end end
it "should not escape Html" do it "should not escape Html" do