Sha256: 649074319b62678145c03a4145f466d59b977e31ddb26ee013f2597387f32ac6

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

PuppetLint.new_check(:resource_reference_without_whitespace) do
  def check
    resource_indexes.each do |resource|
      resource[:param_tokens].select { |param_token|
        ['require', 'subscribe', 'notify', 'before', 'consume', 'export'].include? param_token.value
      }.each do |param_token|
        value_token = param_token.next_code_token
        check = value_token.next_token
        until resource[:param_tokens].include? check or not resource[:tokens].include? check or check.nil?
          case value_token.next_token.type
          when :CLASSREF
            begin
              if value_token.next_token.next_token.type == :WHITESPACE
                notify :error, {
                  :message => 'whitespce between reference type and title',
                  :line    => value_token.next_token.next_token.line,
                  :column  => value_token.next_token.next_token.column
                }
              end
              value_token = value_token.next_token
              check = value_token.next_token
            end
          else
            value_token = value_token.next_token
            check = value_token.next_token
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-lint-resource_reference_syntax-1.0.10 lib/puppet-lint/plugins/resource_reference_without_whitespace.rb