Apply Style/HashSyntax rubocop rule

We were already using it almost everywhere.
This commit is contained in:
Javi Martín
2019-10-26 01:04:57 +02:00
parent 70da5a3801
commit b5eeb3f32f
7 changed files with 18 additions and 15 deletions

View File

@@ -382,6 +382,9 @@ Style/ClassVars:
Style/CollectionMethods: Style/CollectionMethods:
Enabled: true Enabled: true
Style/HashSyntax:
Enabled: true
Style/Not: Style/Not:
Enabled: true Enabled: true

View File

@@ -5,10 +5,10 @@ wb.add_worksheet(name: "Resume") do |sheet|
sheet.add_row [t("legislation.summary.debates_phase"), t("legislation.questions.question.total", count: @process.questions.count)] sheet.add_row [t("legislation.summary.debates_phase"), t("legislation.questions.question.total", count: @process.questions.count)]
@process.questions.each do |question| @process.questions.each do |question|
sheet.add_row [question.title, t("legislation.summary.comments", count: question.comments.count)] sheet.add_row [question.title, t("legislation.summary.comments", count: question.comments.count)]
sheet.add_hyperlink :location => legislation_process_question_url(question.process, question), :ref => sheet.rows.last.cells.first sheet.add_hyperlink location: legislation_process_question_url(question.process, question), ref: sheet.rows.last.cells.first
question.best_comments(3).each do |comment| question.best_comments(3).each do |comment|
sheet.add_row [comment.body, (comment.cached_votes_up - comment.cached_votes_down).to_s + space + t("legislation.summary.votes")] sheet.add_row [comment.body, (comment.cached_votes_up - comment.cached_votes_down).to_s + space + t("legislation.summary.votes")]
sheet.add_hyperlink :location => comment_url(comment), :ref => sheet.rows.last.cells.first sheet.add_hyperlink location: comment_url(comment), ref: sheet.rows.last.cells.first
end end
sheet.add_row ["", ""] sheet.add_row ["", ""]
end end
@@ -19,7 +19,7 @@ wb.add_worksheet(name: "Resume") do |sheet|
Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).order("cached_votes_score desc").each do |proposal| Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).order("cached_votes_score desc").each do |proposal|
sheet.add_row [proposal.title, sheet.add_row [proposal.title,
(proposal.cached_votes_total - proposal.cached_votes_down).to_s + space + t("legislation.summary.votes")] (proposal.cached_votes_total - proposal.cached_votes_down).to_s + space + t("legislation.summary.votes")]
sheet.add_hyperlink :location => legislation_process_proposal_url(proposal.legislation_process_id, proposal), :ref => sheet.rows.last.cells.first sheet.add_hyperlink location: legislation_process_proposal_url(proposal.legislation_process_id, proposal), ref: sheet.rows.last.cells.first
end end
sheet.add_row ["", ""] sheet.add_row ["", ""]
end end
@@ -30,7 +30,7 @@ wb.add_worksheet(name: "Resume") do |sheet|
@process.get_best_annotation_comments.take(10).each do |comment| @process.get_best_annotation_comments.take(10).each do |comment|
sheet.add_row [Legislation::Annotation.find_by(id: comment.commentable_id).quote, ""] sheet.add_row [Legislation::Annotation.find_by(id: comment.commentable_id).quote, ""]
sheet.add_row [comment.body, (comment.cached_votes_up - comment.cached_votes_down).to_s + space + t("legislation.summary.votes")] sheet.add_row [comment.body, (comment.cached_votes_up - comment.cached_votes_down).to_s + space + t("legislation.summary.votes")]
sheet.add_hyperlink :location => comment_url(comment), :ref => sheet.rows.last.cells.first sheet.add_hyperlink location: comment_url(comment), ref: sheet.rows.last.cells.first
end end
end end
end end

View File

@@ -10,6 +10,6 @@ class CreateInappropiateFlags < ActiveRecord::Migration[4.2]
end end
add_index :inappropiate_flags, [:flaggable_type, :flaggable_id] add_index :inappropiate_flags, [:flaggable_type, :flaggable_id]
add_index :inappropiate_flags, [:user_id, :flaggable_type, :flaggable_id], :name => "access_inappropiate_flags" add_index :inappropiate_flags, [:user_id, :flaggable_type, :flaggable_id], name: "access_inappropiate_flags"
end end
end end

View File

@@ -9,11 +9,11 @@ class AddTranslatePages < ActiveRecord::Migration[4.2]
{ migrate_data: true } { migrate_data: true }
) )
change_column :site_customization_pages, :title, :string, :null => true change_column :site_customization_pages, :title, :string, null: true
end end
def self.down def self.down
SiteCustomization::Page.drop_translation_table! SiteCustomization::Page.drop_translation_table!
change_column :site_customization_pages, :title, :string, :null => false change_column :site_customization_pages, :title, :string, null: false
end end
end end

View File

@@ -38,7 +38,7 @@ class RemoteTranslations::Microsoft::AvailableLocales
request = Net::HTTP::Get.new(uri) request = Net::HTTP::Get.new(uri)
request["Ocp-Apim-Subscription-Key"] = Rails.application.secrets.microsoft_api_key request["Ocp-Apim-Subscription-Key"] = Rails.application.secrets.microsoft_api_key
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == "https") do |http| response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request) http.request(request)
end end

View File

@@ -142,7 +142,7 @@ describe "Legislation" do
phases.each do |phase| phases.each do |phase|
within(".legislation-process-list") do within(".legislation-process-list") do
find("li", :text => "#{phase}").click_link find("li", text: "#{phase}").click_link
end end
expect(page).to have_content(document.title) expect(page).to have_content(document.title)

View File

@@ -276,8 +276,8 @@ describe "Valuation budget investments" do
expect(page).to have_content("Create progress bar") expect(page).to have_content("Create progress bar")
select("Primary", :from => "Type") select("Primary", from: "Type")
fill_in("Current progress", :with => 50) fill_in("Current progress", with: 50)
click_button "Create Progress bar" click_button "Create Progress bar"
@@ -295,9 +295,9 @@ describe "Valuation budget investments" do
expect(page).to have_content("Create progress bar") expect(page).to have_content("Create progress bar")
select("Secondary", :from => "Type") select("Secondary", from: "Type")
fill_in("Title", :with => "secondary_progress_bar") fill_in("Title", with: "secondary_progress_bar")
fill_in("Current progress", :with => 50) fill_in("Current progress", with: 50)
click_button "Create Progress bar" click_button "Create Progress bar"
@@ -340,7 +340,7 @@ describe "Valuation budget investments" do
page.find("#progress_bar_#{secondary_progress_bar.id}").click_link("Edit") page.find("#progress_bar_#{secondary_progress_bar.id}").click_link("Edit")
fill_in("Title", :with => "edited") fill_in("Title", with: "edited")
click_button "Update Progress bar" click_button "Update Progress bar"
expect(page).to have_content("Progress bars") expect(page).to have_content("Progress bars")