Commit 6ec8ff06 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Enable more rubocop style checks

parent b9372c99
...@@ -355,7 +355,7 @@ Style/MultilineBlockChain: ...@@ -355,7 +355,7 @@ Style/MultilineBlockChain:
Style/MultilineBlockLayout: Style/MultilineBlockLayout:
Description: 'Ensures newlines after multiline block do statements.' Description: 'Ensures newlines after multiline block do statements.'
Enabled: false Enabled: true
Style/MultilineIfThen: Style/MultilineIfThen:
Description: 'Do not use then for multi-line if/unless.' Description: 'Do not use then for multi-line if/unless.'
...@@ -390,7 +390,7 @@ Style/NegatedWhile: ...@@ -390,7 +390,7 @@ Style/NegatedWhile:
Style/NestedTernaryOperator: Style/NestedTernaryOperator:
Description: 'Use one expression per branch in a ternary operator.' Description: 'Use one expression per branch in a ternary operator.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary'
Enabled: false Enabled: true
Style/Next: Style/Next:
Description: 'Use `next` to skip iteration instead of a condition at the end.' Description: 'Use `next` to skip iteration instead of a condition at the end.'
...@@ -400,17 +400,17 @@ Style/Next: ...@@ -400,17 +400,17 @@ Style/Next:
Style/NilComparison: Style/NilComparison:
Description: 'Prefer x.nil? to x == nil.' Description: 'Prefer x.nil? to x == nil.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
Enabled: false Enabled: true
Style/NonNilCheck: Style/NonNilCheck:
Description: 'Checks for redundant nil checks.' Description: 'Checks for redundant nil checks.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks'
Enabled: false Enabled: true
Style/Not: Style/Not:
Description: 'Use ! instead of not.' Description: 'Use ! instead of not.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
Enabled: false Enabled: true
Style/NumericLiterals: Style/NumericLiterals:
Description: >- Description: >-
...@@ -424,7 +424,7 @@ Style/OneLineConditional: ...@@ -424,7 +424,7 @@ Style/OneLineConditional:
Favor the ternary operator(?:) over Favor the ternary operator(?:) over
if/then/else/end constructs. if/then/else/end constructs.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
Enabled: false Enabled: true
Style/OpMethod: Style/OpMethod:
Description: 'When defining binary operators, name the argument other.' Description: 'When defining binary operators, name the argument other.'
...@@ -436,7 +436,7 @@ Style/ParenthesesAroundCondition: ...@@ -436,7 +436,7 @@ Style/ParenthesesAroundCondition:
Don't use parentheses around the condition of an Don't use parentheses around the condition of an
if/unless/while. if/unless/while.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-parens-if' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-parens-if'
Enabled: false Enabled: true
Style/PercentLiteralDelimiters: Style/PercentLiteralDelimiters:
Description: 'Use `%`-literal delimiters consistently' Description: 'Use `%`-literal delimiters consistently'
......
...@@ -29,7 +29,7 @@ module GitlabMarkdownHelper ...@@ -29,7 +29,7 @@ module GitlabMarkdownHelper
end end
def markdown(text, options={}) def markdown(text, options={})
unless (@markdown and options == @options) unless @markdown && options == @options
@options = options @options = options
gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self, gitlab_renderer = Redcarpet::Render::GitlabHTML.new(self,
user_color_scheme_class, user_color_scheme_class,
......
...@@ -148,7 +148,7 @@ class Notify < ActionMailer::Base ...@@ -148,7 +148,7 @@ class Notify < ActionMailer::Base
headers['References'] = message_id(model) headers['References'] = message_id(model)
headers['X-GitLab-Project'] = "#{@project.name} | " if @project headers['X-GitLab-Project'] = "#{@project.name} | " if @project
if (headers[:subject]) if headers[:subject]
headers[:subject].prepend('Re: ') headers[:subject].prepend('Re: ')
end end
......
...@@ -82,7 +82,7 @@ automatically inspected. Leave blank to include all branches.' ...@@ -82,7 +82,7 @@ automatically inspected. Leave blank to include all branches.'
branch_restriction = restrict_to_branch.to_s branch_restriction = restrict_to_branch.to_s
# check the branch restriction is poplulated and branch is not included # check the branch restriction is poplulated and branch is not included
if branch_restriction.length > 0 && branch_restriction.index(branch) == nil if branch_restriction.length > 0 && branch_restriction.index(branch).nil?
return return
end end
......
...@@ -20,7 +20,7 @@ module API ...@@ -20,7 +20,7 @@ module API
identifier = sudo_identifier() identifier = sudo_identifier()
# If the sudo is the current user do nothing # If the sudo is the current user do nothing
if (identifier && !(@current_user.id == identifier || @current_user.username == identifier)) if identifier && !(@current_user.id == identifier || @current_user.username == identifier)
render_api_error!('403 Forbidden: Must be admin to use sudo', 403) unless @current_user.is_admin? render_api_error!('403 Forbidden: Must be admin to use sudo', 403) unless @current_user.is_admin?
@current_user = User.by_username_or_id(identifier) @current_user = User.by_username_or_id(identifier)
not_found!("No user id or username for: #{identifier}") if @current_user.nil? not_found!("No user id or username for: #{identifier}") if @current_user.nil?
...@@ -33,7 +33,7 @@ module API ...@@ -33,7 +33,7 @@ module API
identifier ||= params[SUDO_PARAM] ||= env[SUDO_HEADER] identifier ||= params[SUDO_PARAM] ||= env[SUDO_HEADER]
# Regex for integers # Regex for integers
if (!!(identifier =~ /^[0-9]+$/)) if !!(identifier =~ /^[0-9]+$/)
identifier.to_i identifier.to_i
else else
identifier identifier
......
...@@ -97,7 +97,7 @@ module Gitlab ...@@ -97,7 +97,7 @@ module Gitlab
in_locked_and_timed_satellite do |merge_repo| in_locked_and_timed_satellite do |merge_repo|
prepare_satellite!(merge_repo) prepare_satellite!(merge_repo)
update_satellite_source_and_target!(merge_repo) update_satellite_source_and_target!(merge_repo)
if (merge_request.for_fork?) if merge_request.for_fork?
repository = Gitlab::Git::Repository.new(merge_repo.path) repository = Gitlab::Git::Repository.new(merge_repo.path)
commits = Gitlab::Git::Commit.between( commits = Gitlab::Git::Commit.between(
repository, repository,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment