<commit_before># Spacing, Identation & Whitespace
# http://docs.puppetlabs.com/guides/style_guide.html#spacing-indentation--whitespace

class PuppetLint::Plugins::CheckWhitespace < PuppetLint::CheckPlugin
  # Check the raw manifest string for lines containing hard tab characters and
  # record an error for each instance found.
  #
  # Returns nothing.
  check 'hard_tabs' do
    manifest_lines.each_with_index do |line, idx|
      if line.include? "\t"
        notify :error, {
          :message    => 'tab character found',
          :linenumber => idx + 1,
          :column     => line.index("\t") + 1,
        }
      end
    end
  end

  check 'trailing_whitespace' do
    line_no = 0
    manifest_lines.each do |line|
      line_no += 1

      # MUST NOT contain trailing white space
      notify :error, :message =>  "trailing whitespace found", :linenumber => line_no if line.end_with? " "
    end
  end

  check '80chars' do
    line_no = 0<commit_msg>Update trailing_whitespace check<commit_after># Spacing, Identation & Whitespace
# http://docs.puppetlabs.com/guides/style_guide.html#spacing-indentation--whitespace

class PuppetLint::Plugins::CheckWhitespace < PuppetLint::CheckPlugin
  # Check the raw manifest string for lines containing hard tab characters and
  # record an error for each instance found.
  #
  # Returns nothing.
  check 'hard_tabs' do
    manifest_lines.each_with_index do |line, idx|
      if line.include? "\t"
        notify :error, {
          :message    => 'tab character found',
          :linenumber => idx + 1,
          :column     => line.index("\t") + 1,
        }
      end
    end
  end

  # Check the raw manifest string for lines ending with whitespace and record
  # an error for each instance found.
  #
  # Returns nothing.
  check 'trailing_whitespace' do
    manifest_lines.each_with_index do |line, idx|
      if line.end_with? ' '
        notify :error, {
          :message    => 'trailing whitespace found',
          :linenumber => idx + 1,
          :column     => line.rindex(' ') + 1,
        }
      end
    end
  end

  check '80chars' do
    line_no = 0
{'fraction_non_alphanumeric': 0.09849198868991517, 'fraction_numerical': 0.006597549481621112, 'mean_word_length': 2.5861486486486487, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '663677', 'n_tokens_mistral': 680, 'n_tokens_neox': 657, 'n_words': 191}