Add and apply Style/RedundantBegin rubocop rule
We're about to add code which might fall into the `RedundantBegin` category, so we're adding the rule in order to prevent that.
This commit is contained in:
@@ -781,6 +781,9 @@ Style/RaiseArgs:
|
||||
Style/RedundantArgument:
|
||||
Enabled: true
|
||||
|
||||
Style/RedundantBegin:
|
||||
Enabled: true
|
||||
|
||||
Style/RedundantCondition:
|
||||
Enabled: true
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ class GraphqlController < ApplicationController
|
||||
class QueryStringError < StandardError; end
|
||||
|
||||
def execute
|
||||
begin
|
||||
raise GraphqlController::QueryStringError if query_string.nil?
|
||||
|
||||
result = ConsulSchema.execute(
|
||||
@@ -28,7 +27,6 @@ class GraphqlController < ApplicationController
|
||||
rescue ArgumentError => e
|
||||
render json: { message: e.message }, status: :bad_request
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ class Legislation::Annotation < ApplicationRecord
|
||||
end
|
||||
|
||||
def store_context
|
||||
begin
|
||||
html = draft_version.body_html
|
||||
doc = Nokogiri::HTML(html)
|
||||
|
||||
@@ -42,7 +41,6 @@ class Legislation::Annotation < ApplicationRecord
|
||||
rescue
|
||||
"<span class=annotator-hl>#{quote}</span>"
|
||||
end
|
||||
end
|
||||
|
||||
def create_first_comment
|
||||
comments.create(body: text, user: author)
|
||||
|
||||
@@ -15,7 +15,6 @@ class MachineLearning
|
||||
end
|
||||
|
||||
def run
|
||||
begin
|
||||
export_proposals_to_json
|
||||
export_budget_investments_to_json
|
||||
export_comments_to_json
|
||||
@@ -66,7 +65,6 @@ class MachineLearning
|
||||
handle_error(e)
|
||||
raise e
|
||||
end
|
||||
end
|
||||
handle_asynchronously :run, queue: "machine_learning"
|
||||
|
||||
class << self
|
||||
|
||||
@@ -84,7 +84,6 @@ end
|
||||
task :install_ruby do
|
||||
on roles(:app) do
|
||||
within release_path do
|
||||
begin
|
||||
current_ruby = capture(:rvm, "current")
|
||||
rescue SSHKit::Command::Failed
|
||||
after "install_ruby", "rvm1:install:rvm"
|
||||
@@ -98,13 +97,11 @@ task :install_ruby do
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :install_node do
|
||||
on roles(:app) do
|
||||
with rails_env: fetch(:rails_env) do
|
||||
begin
|
||||
execute fetch(:fnm_install_node_command)
|
||||
rescue SSHKit::Command::Failed
|
||||
begin
|
||||
@@ -118,7 +115,6 @@ task :install_node do
|
||||
execute fetch(:fnm_install_node_command)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :map_node_bins do
|
||||
|
||||
@@ -11,14 +11,12 @@ describe Officing::VotersController do
|
||||
|
||||
2.times.map do
|
||||
Thread.new do
|
||||
begin
|
||||
post :create, params: {
|
||||
voter: { poll_id: poll.id, user_id: user.id },
|
||||
format: :js
|
||||
}
|
||||
rescue ActionDispatch::IllegalStateError
|
||||
end
|
||||
end
|
||||
end.each(&:join)
|
||||
|
||||
expect(Poll::Voter.count).to eq 1
|
||||
|
||||
@@ -8,7 +8,6 @@ describe Polls::AnswersController do
|
||||
|
||||
2.times.map do
|
||||
Thread.new do
|
||||
begin
|
||||
post :create, params: {
|
||||
question_id: question.id,
|
||||
option_id: question.question_options.find_by(title: "Answer A").id,
|
||||
@@ -16,7 +15,6 @@ describe Polls::AnswersController do
|
||||
}
|
||||
rescue ActionDispatch::IllegalStateError, ActiveRecord::RecordInvalid
|
||||
end
|
||||
end
|
||||
end.each(&:join)
|
||||
|
||||
expect(Poll::Answer.count).to eq 1
|
||||
|
||||
@@ -187,11 +187,9 @@ describe Poll::Answer do
|
||||
|
||||
[answer, other_answer].map do |poll_answer|
|
||||
Thread.new do
|
||||
begin
|
||||
poll_answer.save_and_record_voter_participation
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
end
|
||||
end
|
||||
end.each(&:join)
|
||||
|
||||
expect(Poll::Voter.count).to be 1
|
||||
|
||||
@@ -18,14 +18,12 @@ module GraphQLAPI
|
||||
def extract_fields(response, collection_name, field_chain)
|
||||
fields = field_chain.split(".")
|
||||
dig(response, "data.#{collection_name}.edges").map do |node|
|
||||
begin
|
||||
if fields.size > 1
|
||||
node["node"][fields.first][fields.second]
|
||||
else
|
||||
node["node"][fields.first]
|
||||
end
|
||||
rescue NoMethodError
|
||||
end
|
||||
end.compact
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user