From 60d668e15ffec73e3d534e9d62cd32a13f8319e7 Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Tue, 30 Aug 2022 14:59:04 +0100 Subject: [PATCH] Fix Rubocop errors --- app/_plugins/filters/breadcrumb_title_filter.rb | 9 +++++---- app/_plugins/generators/single_source_generator.rb | 7 +++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/_plugins/filters/breadcrumb_title_filter.rb b/app/_plugins/filters/breadcrumb_title_filter.rb index fc2cecef452d..7f3abd310fbf 100644 --- a/app/_plugins/filters/breadcrumb_title_filter.rb +++ b/app/_plugins/filters/breadcrumb_title_filter.rb @@ -3,14 +3,15 @@ require 'yaml' module Jekyll module BreadcrumbTitleFilter - def initialize(_) - super(_) + def initialize(ctx) + super(ctx) @mapping = YAML.load_file("#{__dir__}/../../breadcrumb_titles.yml") end + def breadcrumb_title(input) - parts = input.split("/") + parts = input.split('/') parts[2] = 'VERSION' - input = "#{parts.join("/")}/" + input = "#{parts.join('/')}/" @mapping[input] end end diff --git a/app/_plugins/generators/single_source_generator.rb b/app/_plugins/generators/single_source_generator.rb index 6c363c55baa0..6281bf3bd951 100644 --- a/app/_plugins/generators/single_source_generator.rb +++ b/app/_plugins/generators/single_source_generator.rb @@ -65,7 +65,7 @@ def create_pages(data, site, product, release, version, assume_generated, nav) # end class SingleSourcePage < Jekyll::Page - def initialize(site, src, dest, product, release, version, nav) # rubocop:disable Lint/MissingSuper, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize, Metrics/ParameterLists + def initialize(site, src, dest, product, release, version, nav) # rubocop:disable Lint/MissingSuper, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity # Configure variables that Jekyll depends on @site = site @@ -98,9 +98,8 @@ def initialize(site, src, dest, product, release, version, nav) # rubocop:disabl is_dir_index = false else file = "src/#{src}/index.md" - unless File.exist?(file) - raise "Could not find a source file at 'src/#{src}.md' or #{file}" - end + raise "Could not find a source file at 'src/#{src}.md' or #{file}" unless File.exist?(file) + is_dir_index = true end