Skip to content

Commit

Permalink
Delint, cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
cycomachead committed Aug 14, 2024
1 parent d5f1067 commit 687e96e
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions _plugins/config_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def validate

KEY_VALIDATIONS.each do |key, validator|
if validator == :inclusion_validator
send(validator, key, config[key.to_s], self.class.const_get("VALID_#{key.upcase}"))
else
send(validator, config[key.to_s]) if @config.key?(key.to_s)
send(validator, key, config[key.to_s], ConfigValidator.const_get("VALID_#{key.upcase}"))
elsif @config.key?(key.to_s)
send(validator, config[key.to_s])
end
end

Expand Down Expand Up @@ -92,14 +92,6 @@ def validate_semester_format(baseurl)
errors << "`baseurl` must be a valid semester (faXX, spXX, suXX or wiXX), not #{baseurl}"
end

def validate_department(dept)
errors << "`course_department` must be one of #{VALID_DEPTS} (not '#{dept}')" unless VALID_DEPTS.include?(dept)
end

def validate_color_theme(color_theme)
errors << "`course_department` must be one of #{VALID_DEPTS} (not '#{dept}')" unless VALID_DEPTS.include?(dept)
end

def inclusion_validator(key, value, allowed)
errors << "`#{key}` must be one of #{allowed} (not '#{value}')" unless allowed.include?(value)
end
Expand Down

0 comments on commit 687e96e

Please sign in to comment.