lib/github_bot/validator/base.rb
# Public: Validates for the provided file at a given hash point that the
# required fields are met
#
# @param file [Sawyer::Resource] The file for reference that is being evaluated
# @param ident [String/Symbol] The text identifier for the hash being evaluated
# @param hash [Hash] The hash to review keys
# @param required_fields [Array] An array of required elements
Validates for the provided file at a given hash point that the
required fields are met
Validates for the provided file at a given hash point that the required fields are met
def validate_required_fields(file:, ident:, hash:, required_fields:, **_opts)
        unless hash
          feedback(
            path: file.filename,
            annotation_level: 'failure',
            message: "#{ident}: Element is empty or nil"
          )
          return
        end
        required_fields.each do |key|
          next unless hash[key].nil?
          feedback(
            path: file.filename,
            annotation_level: 'failure',
            message: "#{ident}: Missing required element '#{key}'"
          )
        end
      end
def validate_required_fields ( file : , ident : , hash : , required_fields : , ** _opts ) unless hash feedback ( path : file . filename , annotation_level : 'failure' , message : "#{ident}: Element is empty or nil" ) return end required_fields . each do | key | next unless hash [ key ] . nil? feedback ( path : file . filename , annotation_level : 'failure' , message : "#{ident}: Missing required element '#{key}'" ) end end
Public: Validates for the provided file at a given hash point that the
required fields are met
Public : Validates for the provided file at a given hash point that the required fields are met
file
The file for reference that is being evaluated
The file for reference that is being evaluated
ident
The text identifier for the hash being evaluated
The text identifier for the hash being evaluated
hash
The hash to review keys
The hash to review keys
required_fields
An array of required elements
An array of required elements
_opts
<not_specific>