Commit 517ead17 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'id-fix-unneeded-condition-offenses' into 'master'

Fix Style/UnneededCondition offenses

See merge request gitlab-org/gitlab!29903
parents f79ec5e6 383b6f45
......@@ -626,17 +626,6 @@ Style/TernaryParentheses:
- 'spec/requests/api/pipeline_schedules_spec.rb'
- 'spec/support/capybara.rb'
# Offense count: 8
# Cop supports --auto-correct.
Style/UnneededCondition:
Exclude:
- 'app/helpers/button_helper.rb'
- 'app/helpers/environment_helper.rb'
- 'app/models/project.rb'
- 'app/services/issuable/clone/base_service.rb'
- 'lib/gitlab/email/message/repository_push.rb'
- 'spec/lib/rspec_flaky/flaky_example_spec.rb'
# Offense count: 99
# Cop supports --auto-correct.
Style/UnneededInterpolation:
......
......@@ -93,8 +93,8 @@ module ButtonHelper
content_tag (href ? :a : :span),
(href ? button_content : title),
class: "#{title.downcase}-selector #{active_class}",
href: (href if href),
data: (data if data)
href: href,
data: data
end
end
......
......@@ -25,7 +25,7 @@ module EnvironmentHelper
def deployment_link(deployment, text: nil)
return unless deployment
link_label = text ? text : "##{deployment.iid}"
link_label = text || "##{deployment.iid}"
link_to link_label, deployment_path(deployment)
end
......
......@@ -1179,11 +1179,7 @@ class Project < ApplicationRecord
end
def issues_tracker
if external_issue_tracker
external_issue_tracker
else
default_issue_tracker
end
external_issue_tracker || default_issue_tracker
end
def external_issue_reference_pattern
......@@ -1328,11 +1324,7 @@ class Project < ApplicationRecord
# rubocop: enable CodeReuse/ServiceClass
def owner
if group
group
else
namespace.try(:owner)
end
group || namespace.try(:owner)
end
def to_ability_name
......
......@@ -47,7 +47,7 @@ module Issuable
end
def new_parent
new_entity.project ? new_entity.project : new_entity.group
new_entity.project || new_entity.group
end
def group
......
......@@ -52,7 +52,7 @@ module Gitlab
end
def compare
@opts[:compare] if @opts[:compare]
@opts[:compare]
end
def diff_refs
......
......@@ -77,7 +77,7 @@ describe RspecFlaky::FlakyExample, :aggregate_failures do
it 'updates the first_flaky_at' do
now = Time.now
expected_first_flaky_at = flaky_example.first_flaky_at ? flaky_example.first_flaky_at : now
expected_first_flaky_at = flaky_example.first_flaky_at || now
Timecop.freeze(now) { flaky_example.update_flakiness! }
expect(flaky_example.first_flaky_at).to eq(expected_first_flaky_at)
......
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