<commit_before># Public: Check the manifest tokens for any resource titles / namevars that
# are not quoted and record a warning for each instance found.
PuppetLint.new_check(:unquoted_resource_title) do
  def check
    title_tokens.each do |token|
      if token.type == :NAME
        if PuppetLint.configuration.fix
          token.type = :SSTRING
          notify_type = :fixed
        else
          notify_type = :warning
        end

        notify notify_type, {
          :message    => 'unquoted resource title',
          :linenumber => token.line,
          :column     => token.column,
        }
      end
    end
  end
end

# Public: Check the tokens of each resource instance for an ensure parameter
# and if found, check that it is the first parameter listed.  If it is not
# the first parameter, record a warning.
PuppetLint.new_check(:ensure_first_param) do
  def check
    resource_indexes.each do |resource|
      resource_tokens = tokens[resource[:start]..resource[:end]]

      param_tokens = resource_tokens.select { |resource_token|
        resource_token.type == :NAME && resource_token.next_code_token.type == :FARROW<commit_msg>Convert unquoted_resource_title to new fix method<commit_after># Public: Check the manifest tokens for any resource titles / namevars that
# are not quoted and record a warning for each instance found.
PuppetLint.new_check(:unquoted_resource_title) do
  def check
    title_tokens.each do |token|
      if token.type == :NAME
        notify :warning, {
          :message    => 'unquoted resource title',
          :linenumber => token.line,
          :column     => token.column,
          :token      => token,
        }
      end
    end
  end

  def fix(problem)
    problem[:token].type = :SSTRING
  end
end

# Public: Check the tokens of each resource instance for an ensure parameter
# and if found, check that it is the first parameter listed.  If it is not
# the first parameter, record a warning.
PuppetLint.new_check(:ensure_first_param) do
  def check
    resource_indexes.each do |resource|
      resource_tokens = tokens[resource[:start]..resource[:end]]

      param_tokens = resource_tokens.select { |resource_token|
        resource_token.type == :NAME && resource_token.next_code_token.type == :FARROW
{'fraction_non_alphanumeric': 0.08007039155301364, 'fraction_numerical': 0.0, 'mean_word_length': 2.9139414802065406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4321218', 'n_tokens_mistral': 644, 'n_tokens_neox': 638, 'n_words': 213}