diff options
author | Sarah German <sgerman@gitlab.com> | 2023-02-15 21:12:15 +0300 |
---|---|---|
committer | Sarah German <sgerman@gitlab.com> | 2023-02-15 21:12:15 +0300 |
commit | 72242bb2aeec3149bafc9b32dc005c94dae848e5 (patch) | |
tree | b0758228ef7371e17054421b7a64beca788eb2c7 | |
parent | 5964155aa0c606e374e82a970dc9699d409a0eae (diff) | |
parent | fc30202ff1c6b30bc2ef40c3972779914c5aea94 (diff) |
Merge branch 'eread/fix-white-space-and-unused-method-argument-rubocop-violations' into 'main'
Fix instances of RuboCop violations
See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/3549
Merged-by: Sarah German <sgerman@gitlab.com>
Approved-by: Sarah German <sgerman@gitlab.com>
Co-authored-by: Evan Read <eread@gitlab.com>
-rw-r--r-- | lib/filters/admonition.rb | 4 | ||||
-rw-r--r-- | lib/filters/badges.rb | 2 | ||||
-rw-r--r-- | lib/filters/convert_mermaid_html.rb | 2 | ||||
-rw-r--r-- | lib/filters/icons.rb | 4 | ||||
-rw-r--r-- | lib/filters/introduced_in.rb | 4 | ||||
-rw-r--r-- | lib/filters/markdown_to_html_ext.rb | 2 | ||||
-rw-r--r-- | lib/filters/tabs.rb | 2 | ||||
-rw-r--r-- | lib/helpers/gitlab_kramdown.rb | 2 | ||||
-rw-r--r-- | lib/tasks/redirects.rake | 1 |
9 files changed, 12 insertions, 11 deletions
diff --git a/lib/filters/admonition.rb b/lib/filters/admonition.rb index 703e553c..d19f97ac 100644 --- a/lib/filters/admonition.rb +++ b/lib/filters/admonition.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -# + # Adapted from the admonition code on http://nanoc.ws/ class AdmonitionFilter < Nanoc::Filter identifier :admonition - def run(content, params = {}) + def run(content, _params = {}) # `#dup` is necessary because `.fragment` modifies the incoming string. Ew! # See https://github.com/sparklemotion/nokogiri/issues/1077 doc = Nokogiri::HTML.fragment(content.dup) diff --git a/lib/filters/badges.rb b/lib/filters/badges.rb index 2cd0e488..bf88f854 100644 --- a/lib/filters/badges.rb +++ b/lib/filters/badges.rb @@ -33,7 +33,7 @@ class BadgesFilter < Nanoc::Filter (?:$|[^`]) # must end of line or anything except backtick }x.freeze - def run(content, params = {}) + def run(content, _params = {}) content.gsub(BADGES_HTML_PATTERN) { generate(Regexp.last_match[:tier].downcase, Regexp.last_match[:type]) } end diff --git a/lib/filters/convert_mermaid_html.rb b/lib/filters/convert_mermaid_html.rb index b219dd49..6968b9b5 100644 --- a/lib/filters/convert_mermaid_html.rb +++ b/lib/filters/convert_mermaid_html.rb @@ -5,7 +5,7 @@ class ConvertMermaidHtml < Nanoc::Filter MERMAID_HTML_PATTERN = %r{<div\ class="mermaid">(?<mermaid_content>.*?)</div>}mx.freeze - def run(content, params = {}) + def run(content, _params = {}) content.gsub(MERMAID_HTML_PATTERN) { generate(Regexp.last_match[:mermaid_content]) } end diff --git a/lib/filters/icons.rb b/lib/filters/icons.rb index 815faa51..95434986 100644 --- a/lib/filters/icons.rb +++ b/lib/filters/icons.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -# + # This allows us to add icons to our documentation using standard Markdown # # Usage: `**{<icon-name>, <optional-size>, <optional-class>}**` @@ -20,7 +20,7 @@ class IconsFilter < Nanoc::Filter ICON_HTML_PATTERN = %r{<strong>#{ICON_PATTERN}</strong>}.freeze ICON_MARKDOWN_PATTERN = %r{\*\*#{ICON_PATTERN}\*\*}.freeze - def run(content, params = {}) + def run(content, _params = {}) content.gsub(ICON_HTML_PATTERN) { generate(Regexp.last_match(1), Regexp.last_match(2), Regexp.last_match(3)) } end diff --git a/lib/filters/introduced_in.rb b/lib/filters/introduced_in.rb index 06614d35..9ab479cc 100644 --- a/lib/filters/introduced_in.rb +++ b/lib/filters/introduced_in.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -# + # Adapted from the admonition code on http://nanoc.ws/ class IntroducedInFilter < Nanoc::Filter identifier :introduced_in - def run(content, params = {}) + def run(content, _params = {}) # `#dup` is necessary because `.fragment` modifies the incoming string. Ew! # See https://github.com/sparklemotion/nokogiri/issues/1077 @incremental_id = 0 diff --git a/lib/filters/markdown_to_html_ext.rb b/lib/filters/markdown_to_html_ext.rb index 14ef06e0..e3b5cfd2 100644 --- a/lib/filters/markdown_to_html_ext.rb +++ b/lib/filters/markdown_to_html_ext.rb @@ -6,7 +6,7 @@ module Nanoc::Filters # Convert internal URLs that link to `.md` files to instead link to # { }`.html` files since that's what Nanoc actually serves. - def run(content, params = {}) + def run(content, _params = {}) content.gsub(%r{href="(\S*.md\S*)"}) do |result| # Fetch all links in the HTML Document if %r{^href="http}.match(result).nil? # Check if link is internal result.gsub!(%r{\.md}, '.html') # Replace the extension if link is internal diff --git a/lib/filters/tabs.rb b/lib/filters/tabs.rb index b2d00011..8851c09d 100644 --- a/lib/filters/tabs.rb +++ b/lib/filters/tabs.rb @@ -6,7 +6,7 @@ class TabsFilter < Nanoc::Filter TABSET_PATTERN = %r{<p>::Tabs</p>(?<tabs_wrapper>.*?)<p>::EndTabs</p>}mx.freeze TAB_TITLE_PATTERN = %r{<p>:::TabTitle\s(?<tab_title>.*?)</p>}mx.freeze - def run(content, params = {}) + def run(content, _params = {}) new_content = content.gsub(TAB_TITLE_PATTERN) { generate_titles(Regexp.last_match[:tab_title]) } new_content.gsub(TABSET_PATTERN) { generate_wrapper(Regexp.last_match[:tabs_wrapper]) } end diff --git a/lib/helpers/gitlab_kramdown.rb b/lib/helpers/gitlab_kramdown.rb index e9761f90..ec86f0d6 100644 --- a/lib/helpers/gitlab_kramdown.rb +++ b/lib/helpers/gitlab_kramdown.rb @@ -3,7 +3,7 @@ module Nanoc::Helpers module GitLabKramdown require 'kramdown' - def markdown(item, params = {}) + def markdown(item, _params = {}) Nanoc::Filters::GitLabKramdown.new.run( item, { diff --git a/lib/tasks/redirects.rake b/lib/tasks/redirects.rake index 0083424f..ba7ca388 100644 --- a/lib/tasks/redirects.rake +++ b/lib/tasks/redirects.rake @@ -1,4 +1,5 @@ # frozen_string_literal: true + require './lib/tasks/task_helpers' require 'date' require 'pathname' |