Add and apply Style/RedundantParentheses rule

Parentheses make the code harder to read in these cases.
This commit is contained in:
Javi Martín
2021-08-11 15:06:25 +02:00
parent 5abd0466e2
commit 0be6eb9512
7 changed files with 16 additions and 15 deletions

View File

@@ -493,6 +493,9 @@ Style/RedundantFreeze:
Style/RedundantInterpolation:
Enabled: true
Style/RedundantParentheses:
Enabled: true
Style/RedundantReturn:
Enabled: true

View File

@@ -35,7 +35,7 @@ class Legislation::ProcessesController < Legislation::BaseController
set_process
@phase = :debate_phase
if @process.debate_phase.started? || (current_user&.administrator?)
if @process.debate_phase.started? || current_user&.administrator?
render :debate
else
render :phase_not_open
@@ -123,7 +123,7 @@ class Legislation::ProcessesController < Legislation::BaseController
@proposals = @proposals.send(@current_filter).page(params[:page])
end
if @process.proposals_phase.started? || (current_user&.administrator?)
if @process.proposals_phase.started? || current_user&.administrator?
legislation_proposal_votes(@proposals)
render :proposals
else

View File

@@ -62,7 +62,7 @@ module UsersHelper
def show_admin_menu?(user = nil)
unless namespace == "officing"
current_administrator? || current_moderator? || current_valuator? || current_manager? ||
(user&.administrator?) || current_poll_officer? || current_sdg_manager?
user&.administrator? || current_poll_officer? || current_sdg_manager?
end
end

View File

@@ -3,11 +3,11 @@ module Measurable
class_methods do
def title_max_length
@title_max_length ||= (columns.find { |c| c.name == "title" }&.limit) || 80
@title_max_length ||= columns.find { |c| c.name == "title" }&.limit || 80
end
def responsible_name_max_length
@responsible_name_max_length ||= (columns.find { |c| c.name == "responsible_name" }&.limit) || 60
@responsible_name_max_length ||= columns.find { |c| c.name == "responsible_name" }&.limit || 60
end
def question_max_length

View File

@@ -13,10 +13,10 @@
<%= raw setting["html.per_page_code_head"] %>
</head>
<body class="<%= yield (:body_class) %> public">
<body class="<%= yield(:body_class) %> public">
<%= raw setting["html.per_page_code_body"] %>
<div class="wrapper <%= yield (:wrapper_class) %>">
<div class="wrapper <%= yield(:wrapper_class) %>">
<%= render "layouts/header", with_subnavigation: true %>
<% if request.headers["User-Agent"] =~ /MSIE/ && cookies["ie_alert_closed"] != "true" %>

View File

@@ -16,7 +16,7 @@
</p>
<% end %>
<%= image_tag ("annotator_help.gif"), alt: t("annotator.help.alt") %>
<%= image_tag "annotator_help.gif", alt: t("annotator.help.alt") %>
</div>
</div>
</div>

View File

@@ -29,13 +29,11 @@
class: "button hollow expanded"
] if feature?(:polls)
),
(
[
t("pages.help.menu.processes"),
"#processes",
class: "button hollow expanded"
]
),
[
t("pages.help.menu.processes"),
"#processes",
class: "button hollow expanded"
],
[
t("pages.help.menu.other"),
"#other",