Skip to content

Commit

Permalink
Fix rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
phrdang committed Jun 25, 2024
1 parent 6db5707 commit b9a62a1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions _plugins/code_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b9a62a1

Please sign in to comment.