From de40cd42e63e05b27d35354c0fedc906a971cdc0 Mon Sep 17 00:00:00 2001 From: William Franklin Date: Fri, 12 Oct 2018 09:38:30 +0000 Subject: [PATCH 1/7] Fix Layout/EmptyLinesAroundClassBody offenses --- app/controllers/content_items_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index 9ccad31f1..a3d0eb42d 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -1,5 +1,4 @@ class ContentItemsController < ApplicationController - rescue_from GdsApi::HTTPForbidden, with: :error_403 rescue_from GdsApi::HTTPNotFound, with: :error_notfound rescue_from GdsApi::HTTPGone, with: :error_410 From 852e9c775b6e4e403c102d08bd1f1907f94ab30a Mon Sep 17 00:00:00 2001 From: William Franklin Date: Fri, 12 Oct 2018 09:38:36 +0000 Subject: [PATCH 2/7] Fix Security/YAMLLoad offenses --- lib/helpers/wraith_config_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helpers/wraith_config_helper.rb b/lib/helpers/wraith_config_helper.rb index 61a9d76fa..378819c66 100644 --- a/lib/helpers/wraith_config_helper.rb +++ b/lib/helpers/wraith_config_helper.rb @@ -20,7 +20,7 @@ def create_config(extra_config = {}) private def load_template - YAML::load(File.open(TEMPLATE_PATH)) + YAML::safe_load(File.open(TEMPLATE_PATH)) end def build_paths From 8dbf859c1a4f4ce5534e82cc96388673dfa1e456 Mon Sep 17 00:00:00 2001 From: William Franklin Date: Fri, 12 Oct 2018 09:38:39 +0000 Subject: [PATCH 3/7] Fix Style/ExpandPathArguments offenses --- test/test_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 2abbc2f16..e14f64b9d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,7 +2,7 @@ ENV['GOVUK_APP_DOMAIN'] = 'test.gov.uk' ENV['GOVUK_ASSET_ROOT'] = 'http://static.test.gov.uk' -require File.expand_path('../../config/environment', __FILE__) +require File.expand_path('../config/environment', __dir__) require 'rails/test_help' require 'capybara/rails' require 'mocha/minitest' From 568b8f00a4dd92a105c15437640f306f57f9670c Mon Sep 17 00:00:00 2001 From: William Franklin Date: Fri, 12 Oct 2018 10:40:54 +0100 Subject: [PATCH 4/7] Fix Lint/UriEscapeUnescape offenses --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fce9e1287..501a6835b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,6 +11,6 @@ def content_item_path .compact .join('.') - '/' + URI.encode(path_and_optional_locale) + '/' + URI.encode(path_and_optional_locale) # rubocop:disable Lint/UriEscapeUnescape end end From 3d1d5543af633fe042dfdd04843a8f93910d6258 Mon Sep 17 00:00:00 2001 From: William Franklin Date: Fri, 12 Oct 2018 10:42:32 +0100 Subject: [PATCH 5/7] Fix Lint/UselessAssignment offenses --- test/presenters/travel_advice_presenter_test.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/presenters/travel_advice_presenter_test.rb b/test/presenters/travel_advice_presenter_test.rb index 0d849b0e0..4b940076e 100644 --- a/test/presenters/travel_advice_presenter_test.rb +++ b/test/presenters/travel_advice_presenter_test.rb @@ -83,9 +83,7 @@ def schema_name test "navigation items are presented as trackable links unless they are the current part" do example = schema_item("full-country") - base_path = example["base_path"] current_part = example["details"]["parts"].first - another_part = example["details"]["parts"][1] first_part_presented = presented_item("full-country", current_part["slug"]) navigation_items = first_part_presented.parts_navigation From 1b18a841a6be6920c8da09eb2dbb2c76517a2b7e Mon Sep 17 00:00:00 2001 From: William Franklin Date: Fri, 12 Oct 2018 10:44:39 +0100 Subject: [PATCH 6/7] Fix Style/FormatStringToken offenses --- lib/helpers/document_types_helper.rb | 4 ++-- lib/helpers/wraith_config_helper.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/helpers/document_types_helper.rb b/lib/helpers/document_types_helper.rb index 368b9bc64..32a673355 100644 --- a/lib/helpers/document_types_helper.rb +++ b/lib/helpers/document_types_helper.rb @@ -1,8 +1,8 @@ require 'rest-client' class DocumentTypesHelper - ALL_SEARCH_ENDPOINT = "https://www.gov.uk/api/search.json?facet_content_store_document_type=100,example_scope:global,examples:%{sample_size}&filter_rendering_app=government-frontend&count=0".freeze - SINGLE_SEARCH_ENDPOINT = "https://www.gov.uk/api/search.json?filter_content_store_document_type=%{document_type}&count=%{sample_size}".freeze + ALL_SEARCH_ENDPOINT = "https://www.gov.uk/api/search.json?facet_content_store_document_type=100,example_scope:global,examples:%s&filter_rendering_app=government-frontend&count=0".freeze + SINGLE_SEARCH_ENDPOINT = "https://www.gov.uk/api/search.json?filter_content_store_document_type=%s&count=%s".freeze def initialize(sample_size = 10) @sample_size = sample_size diff --git a/lib/helpers/wraith_config_helper.rb b/lib/helpers/wraith_config_helper.rb index 378819c66..dab61c377 100644 --- a/lib/helpers/wraith_config_helper.rb +++ b/lib/helpers/wraith_config_helper.rb @@ -2,7 +2,7 @@ class WraithConfigHelper attr_accessor :name, :paths TEMPLATE_PATH = "test/wraith/config.yaml".freeze - OUTPUT_PATH = 'test/wraith/wip-config-%{suffix}.yaml'.freeze + OUTPUT_PATH = 'test/wraith/wip-config-%s.yaml'.freeze def initialize(name, paths) @name = name From 525bf2ea85e6663af39fa6c35dacd2a1d5c26b1d Mon Sep 17 00:00:00 2001 From: William Franklin Date: Fri, 12 Oct 2018 10:53:02 +0100 Subject: [PATCH 7/7] Fix Style/MixinUsage offenses --- test/presenters/content_item/shareable_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/presenters/content_item/shareable_test.rb b/test/presenters/content_item/shareable_test.rb index f653fc2af..6ebcfd07b 100644 --- a/test/presenters/content_item/shareable_test.rb +++ b/test/presenters/content_item/shareable_test.rb @@ -1,7 +1,8 @@ require 'test_helper' -include ERB::Util class ContentItemShareableTest < ActiveSupport::TestCase + include ERB::Util + class DummyContentItem include ContentItem::Shareable attr_accessor :content_item, :title