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: Style/RedundantInterpolation:
Enabled: true Enabled: true
Style/RedundantParentheses:
Enabled: true
Style/RedundantReturn: Style/RedundantReturn:
Enabled: true Enabled: true

View File

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

View File

@@ -62,7 +62,7 @@ module UsersHelper
def show_admin_menu?(user = nil) def show_admin_menu?(user = nil)
unless namespace == "officing" unless namespace == "officing"
current_administrator? || current_moderator? || current_valuator? || current_manager? || 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
end end

View File

@@ -3,11 +3,11 @@ module Measurable
class_methods do class_methods do
def title_max_length 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 end
def responsible_name_max_length 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 end
def question_max_length def question_max_length

View File

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

View File

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

View File

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