From b9a62a1d7f8a35095a9662fab86bc8ae253c2a3b Mon Sep 17 00:00:00 2001 From: Rebecca Phuonghanh Dang Date: Mon, 24 Jun 2024 21:54:56 -0700 Subject: [PATCH] Fix rubocop offenses --- _plugins/code_tag.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/_plugins/code_tag.rb b/_plugins/code_tag.rb index b60887b..6f303b3 100644 --- a/_plugins/code_tag.rb +++ b/_plugins/code_tag.rb @@ -47,7 +47,9 @@ def get_extension_and_comment_chars(file_name) @file_extension = extension @comment_chars = comment_chars + # rubocop:disable Lint/NonLocalExitFromIterator return + # rubocop:enable Lint/NonLocalExitFromIterator end raise ArgumentError, @@ -61,9 +63,11 @@ def parse_params(params) raise ArgumentError, 'Missing first argument to code tag, which must be a file path relative to _includes directory' end + if show_solution.nil? raise ArgumentError, - 'Missing second argument to code tag, which must be a boolean representing whether solutions are displayed' + 'Missing second argument to code tag, which must be a boolean \ + representing whether solutions are displayed' end get_extension_and_comment_chars(file_name) @@ -109,7 +113,8 @@ def parse_file_lines(raw_lines) elsif line.strip == full_end_solution unless saw_begin raise CodeTagError, - "'#{full_end_solution}' without preceding '#{full_begin_solution}' at _includes/#{@file_name}:#{index + 1}" + "'#{full_end_solution}' without preceding '#{full_begin_solution}' at \ + _includes/#{@file_name}:#{index + 1}" end saw_begin = false @@ -135,7 +140,8 @@ def render(context) unless boolean?(jekyll_variable_value) raise ArgumentError, - "Second argument to code tag must be a boolean, not '#{jekyll_variable_value}' (type #{jekyll_variable_value.class})" + "Second argument to code tag must be a boolean, not \ + '#{jekyll_variable_value}' (type #{jekyll_variable_value.class})" end @show_solution = jekyll_variable_value