From 12658e33a92f6197599767317fa4e80fc95235bc Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 20 Sep 2017 16:07:19 +0200 Subject: [PATCH 1/4] Use %w string array syntax to comply with the 140 char line limit --- app/helpers/admin_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index f9c2e8c69..2cefcdf27 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -25,7 +25,7 @@ module AdminHelper end def menu_polls? - ["polls", "questions", "officers", "booths", "officer_assignments", "booth_assignments", "recounts", "results", "shifts"].include? controller_name + %w[polls questions officers booths officer_assignments booth_assignments recounts results shifts].include? controller_name end def menu_profiles? @@ -39,7 +39,7 @@ module AdminHelper def menu_customization? ["pages", "images", "content_blocks"].include? controller_name end - + def official_level_options options = [["", 0]] (1..5).each do |i| From 03ee43bfee0bd63e3474f8e66da01032462869b8 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 20 Sep 2017 16:07:53 +0200 Subject: [PATCH 2/4] Use weeks instead of week for more than one --- app/controllers/officing/polls_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/officing/polls_controller.rb b/app/controllers/officing/polls_controller.rb index 46bcf9f37..5ba94e024 100644 --- a/app/controllers/officing/polls_controller.rb +++ b/app/controllers/officing/polls_controller.rb @@ -7,7 +7,7 @@ class Officing::PollsController < Officing::BaseController def final @polls = if current_user.poll_officer? - current_user.poll_officer.final_days_assigned_polls.select {|poll| poll.ends_at > 2.week.ago && poll.expired?} + current_user.poll_officer.final_days_assigned_polls.select {|poll| poll.ends_at > 2.weeks.ago && poll.expired?} else [] end From c2d154b1ac72a231d221c2e0d30f51433d896e3d Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 20 Sep 2017 16:12:28 +0200 Subject: [PATCH 3/4] Comply with Style/PredicateName rule for ? method names --- lib/census_api.rb | 2 +- lib/document_parser.rb | 2 +- lib/local_census.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/census_api.rb b/lib/census_api.rb index 066c0be95..931781c6d 100644 --- a/lib/census_api.rb +++ b/lib/census_api.rb @@ -119,7 +119,7 @@ class CensusApi {get_habita_datos_response: {get_habita_datos_return: {datos_habitante: {}, datos_vivienda: {}}}} end - def is_dni?(document_type) + def dni?(document_type) document_type.to_s == "1" end diff --git a/lib/document_parser.rb b/lib/document_parser.rb index c60b180dc..9e59c6b75 100644 --- a/lib/document_parser.rb +++ b/lib/document_parser.rb @@ -5,7 +5,7 @@ module DocumentParser document_number = document_number.to_s.gsub(/[^0-9A-Za-z]/i, '') variants = [] - if is_dni?(document_type) + if dni?(document_type) document_number, letter = split_letter_from(document_number) number_variants = get_number_variants_with_leading_zeroes_from(document_number) letter_variants = get_letter_variants(number_variants, letter) diff --git a/lib/local_census.rb b/lib/local_census.rb index 6c6e8fe12..1a0428787 100644 --- a/lib/local_census.rb +++ b/lib/local_census.rb @@ -63,7 +63,7 @@ class LocalCensus LocalCensusRecord.find_by(document_type: document_type, document_number: document_number) end - def is_dni?(document_type) + def dni?(document_type) document_type.to_s == "1" end From 6aba5de8017ee2e54cb16a6e99f5b2fb33947b1a Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 20 Sep 2017 16:13:08 +0200 Subject: [PATCH 4/4] Make rubocop display cop name and style guide link to improve output --- .rubocop.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index e2cc2bf93..49de3550b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,8 @@ inherit_from: .rubocop_todo.yml AllCops: + DisplayCopNames: true + DisplayStyleGuide: true Include: - '**/Rakefile' - '**/config.ru'