Commit 7ec0b7b5 authored by Igor Drozdov's avatar Igor Drozdov

Fix Style/TernaryParentheses offenses

The cop checks for unneeded parentheses for ternary operators
It would be cool to have it enabled for all files
parent 1e39f6f5
......@@ -613,18 +613,6 @@ Style/StringLiteralsInInterpolation:
Style/SymbolProc:
Enabled: false
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
Style/TernaryParentheses:
Exclude:
- 'app/finders/projects_finder.rb'
- 'app/helpers/namespaces_helper.rb'
- 'lib/gitlab/ci/build/artifacts/metadata/entry.rb'
- 'spec/requests/api/pipeline_schedules_spec.rb'
- 'spec/support/capybara.rb'
# Offense count: 99
# Cop supports --auto-correct.
Style/UnneededInterpolation:
......
......@@ -151,11 +151,11 @@ class ProjectsFinder < UnionFinder
end
def by_personal(items)
(params[:personal].present? && current_user) ? items.personal(current_user) : items
params[:personal].present? && current_user ? items.personal(current_user) : items
end
def by_starred(items)
(params[:starred].present? && current_user) ? items.starred_by(current_user) : items
params[:starred].present? && current_user ? items.starred_by(current_user) : items
end
def by_trending(items)
......
......@@ -80,8 +80,8 @@ module NamespacesHelper
visibility_level: n.visibility_level_value,
visibility: n.visibility,
name: n.name,
show_path: (type == 'group') ? group_path(n) : user_path(n),
edit_path: (type == 'group') ? edit_group_path(n) : nil
show_path: type == 'group' ? group_path(n) : user_path(n),
edit_path: type == 'group' ? edit_group_path(n) : nil
}]
end
......
......@@ -50,7 +50,7 @@ module Gitlab
end
def basename
(directory? && !blank_node?) ? name + '/' : name
directory? && !blank_node? ? name + '/' : name
end
def name
......
......@@ -67,7 +67,7 @@ describe API::PipelineSchedules do
end
def active?(str)
(str == 'active') ? true : false
str == 'active'
end
end
end
......
......@@ -7,7 +7,7 @@ require 'capybara-screenshot/rspec'
require 'selenium-webdriver'
# Give CI some extra time
timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 60 : 30
timeout = ENV['CI'] || ENV['CI_SERVER'] ? 60 : 30
# Define an error class for JS console messages
JSConsoleError = Class.new(StandardError)
......
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