Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off diff linting #1498

Merged
merged 9 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
source 'https://rubygems.org'
source "https://rubygems.org"

ruby File.read(".ruby-version").strip

gem 'asset_bom_removal-rails', '~> 1.0'
gem 'dalli'
gem 'htmlentities', '~> 4.3'
gem 'rack_strip_client_ip', '~> 0.0.2'
gem 'rails', '~> 5.2.3'
gem 'rails-controller-testing', '~> 1.0'
gem 'rails-i18n', '>= 4.0.4'
gem 'rails_translation_manager', '~> 0.1.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'gds-api-adapters', '~> 60.0'
gem 'govuk_ab_testing', '~> 2.4'
gem 'govuk_app_config', '~> 2.0'
gem 'govuk_frontend_toolkit', '~> 8.2.0'
gem 'govuk_publishing_components', '~> 21.0.0'
gem 'plek', '~> 3.0'
gem 'slimmer', '~> 13.1'
gem "asset_bom_removal-rails", "~> 1.0"
gem "dalli"
gem "gds-api-adapters", "~> 60.0"
gem "govuk_ab_testing", "~> 2.4"
gem "govuk_app_config", "~> 2.0"
gem "govuk_frontend_toolkit", "~> 8.2.0"
gem "govuk_publishing_components", "~> 21.0.0"
gem "htmlentities", "~> 4.3"
gem "plek", "~> 3.0"
gem "rack_strip_client_ip", "~> 0.0.2"
gem "rails", "~> 5.2.3"
gem "rails-controller-testing", "~> 1.0"
gem "rails-i18n", ">= 4.0.4"
gem "rails_translation_manager", "~> 0.1.0"
gem "sass-rails", "~> 5.0"
gem "slimmer", "~> 13.1"
gem "uglifier", ">= 1.3.0"

group :development, :test do
gem 'govuk-lint'
gem 'govuk_schemas', '~> 4.0'
gem 'jasmine-rails'
gem "govuk-lint"
gem "govuk_schemas", "~> 4.0"
gem "jasmine-rails"
end

group :development do
gem 'pry'
gem 'better_errors'
gem 'binding_of_caller'
gem 'wraith', '~> 4.2'
gem "better_errors"
gem "binding_of_caller"
gem "pry"
gem "wraith", "~> 4.2"
end

group :test do
gem 'capybara'
gem 'govuk_test'
gem 'faker'
gem 'minitest-reporters'
gem 'mocha'
gem 'webmock', '~> 3.7.4', require: false
gem "capybara"
gem "faker"
gem "govuk_test"
gem "minitest-reporters"
gem "mocha"
gem "webmock", "~> 3.7.4", require: false
end
6 changes: 5 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ REPOSITORY = 'government-frontend'

node {
govuk.setEnvar("PUBLISHING_E2E_TESTS_COMMAND", "test-government-frontend")
govuk.buildProject(publishingE2ETests: true, brakeman: true)
govuk.buildProject(
publishingE2ETests: true,
brakeman: true,
rubyLintDiff: false,
)
}
6 changes: 3 additions & 3 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ApplicationController < ActionController::Base
if ENV["BASIC_AUTH_USERNAME"]
http_basic_authenticate_with(
name: ENV.fetch("BASIC_AUTH_USERNAME"),
password: ENV.fetch("BASIC_AUTH_PASSWORD")
password: ENV.fetch("BASIC_AUTH_PASSWORD"),
)
end

Expand All @@ -17,8 +17,8 @@ def content_item_path
path_and_optional_locale = params
.values_at(:path, :locale)
.compact
.join('.')
.join(".")

'/' + URI.encode(path_and_optional_locale) # rubocop:disable Lint/UriEscapeUnescape
"/" + URI.encode(path_and_optional_locale) # rubocop:disable Lint/UriEscapeUnescape
end
end
20 changes: 10 additions & 10 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def set_guide_draft_access_token
def load_content_item
content_item = Services.content_store.content_item(content_item_path)

if Services.feature_toggler.use_recommended_related_links?(content_item['links'], request.headers)
content_item['links']['ordered_related_items'] = content_item['links'].fetch('suggested_ordered_related_items', [])
if Services.feature_toggler.use_recommended_related_links?(content_item["links"], request.headers)
content_item["links"]["ordered_related_items"] = content_item["links"].fetch("suggested_ordered_related_items", [])
end

@content_item = PresenterBuilder.new(content_item, content_item_path).presenter
Expand All @@ -75,9 +75,9 @@ def format_banner_links(links, type)
"track-action": "1.#{index} #{type}",
"track-label": base_path,
"track-options": {
dimension29: title
}
}
dimension29: title,
},
},
)
end
end
Expand Down Expand Up @@ -114,7 +114,7 @@ def set_access_control_allow_origin_header
end

def set_use_recommended_related_links_header
response.headers['Vary'] = [response.headers['Vary'], FeatureFlagNames.recommended_related_links].compact.join(', ')
response.headers["Vary"] = [response.headers["Vary"], FeatureFlagNames.recommended_related_links].compact.join(", ")

related_links_request_header = RequestHelper.get_header(FeatureFlagNames.recommended_related_links, request.headers)
required_header_value = Services.feature_toggler.feature_flags.get_feature_flag(FeatureFlagNames.recommended_related_links)
Expand All @@ -131,7 +131,7 @@ def service_url(original_url)
return original_url if ga_param.nil?

url = URI.parse(original_url)
new_query_ar = URI.decode_www_form(url.query || '') << ["_ga", ga_param]
new_query_ar = URI.decode_www_form(url.query || "") << ["_ga", ga_param]
url.query = URI.encode_www_form(new_query_ar)
url.to_s
end
Expand All @@ -145,15 +145,15 @@ def error_403(exception)
end

def error_notfound
render plain: 'Not found', status: :not_found
render plain: "Not found", status: :not_found
end

def error_406
render plain: 'Not acceptable', status: 406
render plain: "Not acceptable", status: 406
end

def error_410
render plain: 'Gone', status: 410
render plain: "Gone", status: 410
end

def error_redirect(exception)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def load_content_item
)

# Use provided schema_name rather than a randomly generated one
random_example['schema_name'] = params[:schema].underscore
random_example["schema_name"] = params[:schema].underscore
@content_item = present(random_example)
end

Expand Down
8 changes: 4 additions & 4 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def page_text_direction
end

def t_locale_fallback(key, options = {})
options['locale'] = I18n.locale
options["locale"] = I18n.locale
options[:fallback] = nil
translation = I18n.t(key, options)

Expand All @@ -22,7 +22,7 @@ def wrapper_class
def active_proposition
# Which of the government sections is the page part of?
# Derive this from the request path, eg: /government/consultations => consultations
active = request.original_fullpath.split('/')[2]
active = request.original_fullpath.split("/")[2]
active_proposition_mapping.fetch(active, active)
end

Expand All @@ -36,8 +36,8 @@ def active_proposition_mapping
# Some paths don't map directly to the position nav
# eg /government/news sits under 'announcements'
{
'news' => 'announcements',
'fatalities' => 'announcements'
"news" => "announcements",
"fatalities" => "announcements",
}
end
end
2 changes: 1 addition & 1 deletion app/helpers/machine_readable_metadata_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module MachineReadableMetadataHelper
def machine_readable_metadata(args)
locals = { content_item: @content_item.content_item }.merge(args)
render('govuk_publishing_components/components/machine_readable_metadata', locals)
render("govuk_publishing_components/components/machine_readable_metadata", locals)
end
end
2 changes: 1 addition & 1 deletion app/helpers/phase_label_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def render_phase_label(presented_object, message)
locals = {}
locals[:message] = message if message.present?

render 'govuk_publishing_components/components/phase_banner', locals.merge(phase: presented_object.phase)
render "govuk_publishing_components/components/phase_banner", locals.merge(phase: presented_object.phase)
end
end
end
1 change: 1 addition & 0 deletions app/helpers/statistics_announcement_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ def on_in_between_for_release_date(date)
return "on #{date}" if date_is_exact_format?(date)
return "in #{date}" if date_is_one_month_format?(date)
return "between #{replace_on_with_and(date)}" if date_is_two_month_format?(date)

date
end

Expand Down
3 changes: 2 additions & 1 deletion app/helpers/typography_helper.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module TypographyHelper
def nbsp_between_last_two_words(text)
return text if text.nil?

escaped_text = html_escape_once(text.strip)
escaped_text.sub(/\s([\w\.\?\!\:]+)$/, '&nbsp;\1').html_safe
end

def strip_trailing_colons(text)
text.gsub(/\:$/, '')
text.gsub(/\:$/, "")
end
end
4 changes: 2 additions & 2 deletions app/lib/services.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'gds_api/content_store'
require "gds_api/content_store"

module Services
def self.content_store
Expand All @@ -13,7 +13,7 @@ def self.content_store

def self.feature_toggler
@feature_toggler ||= FeatureToggler.new(
HttpFeatureFlags.instance
HttpFeatureFlags.instance,
)
end
end
4 changes: 2 additions & 2 deletions app/models/feature_toggler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def initialize(feature_flags)
def use_recommended_related_links?(content_item_links, request_headers)
return false if content_item_links.nil?

content_item_links.fetch('ordered_related_items', []).empty? &&
content_item_links.fetch('ordered_related_items_overrides', []).empty? &&
content_item_links.fetch("ordered_related_items", []).empty? &&
content_item_links.fetch("ordered_related_items_overrides", []).empty? &&
@feature_flags.feature_enabled?(FeatureFlagNames.recommended_related_links, request_headers)
end
end
8 changes: 4 additions & 4 deletions app/presenters/consultation_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ def final_outcome_documents?
end

def final_outcome_documents
final_outcome_documents_list.join('')
final_outcome_documents_list.join("")
end

def public_feedback_documents?
public_feedback_documents_list.any?
end

def public_feedback_documents
public_feedback_documents_list.join('')
public_feedback_documents_list.join("")
end

def public_feedback_detail
Expand All @@ -83,7 +83,7 @@ def documents?
end

def documents
documents_list.join('')
documents_list.join("")
end

def ways_to_respond?
Expand Down Expand Up @@ -127,7 +127,7 @@ def display_date_and_time(date, rollback_midnight = false)
# 12am on 10 January becomes 11:59pm on 9 January
time = time - 1.second if time.strftime(time_format) == "12:00am"
end
I18n.l(time, format: "#{time_format} on #{date_format}").gsub(':00', '').gsub('12pm', 'midday').gsub('12am on ', '').strip
I18n.l(time, format: "#{time_format} on #{date_format}").gsub(":00", "").gsub("12pm", "midday").gsub("12am on ", "").strip
end

def ways_to_respond
Expand Down
Loading