puppet-syntax-4.0.0/0000755000004100000410000000000014565136603014415 5ustar www-datawww-datapuppet-syntax-4.0.0/.gitignore0000644000004100000410000000026214565136603016405 0ustar www-datawww-data*.gem *.rbc .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp vendor/ .idea/ .vendor/ puppet-syntax-4.0.0/.github/0000755000004100000410000000000014565136603015755 5ustar www-datawww-datapuppet-syntax-4.0.0/.github/dependabot.yml0000644000004100000410000000054114565136603020605 0ustar www-datawww-dataversion: 2 updates: # raise PRs for gem updates - package-ecosystem: bundler directory: "/" schedule: interval: daily time: "13:00" open-pull-requests-limit: 10 # Maintain dependencies for GitHub Actions - package-ecosystem: github-actions directory: "/" schedule: interval: daily time: "13:00" open-pull-requests-limit: 10 puppet-syntax-4.0.0/.github/workflows/0000755000004100000410000000000014565136603020012 5ustar www-datawww-datapuppet-syntax-4.0.0/.github/workflows/release.yml0000644000004100000410000000164014565136603022156 0ustar www-datawww-dataname: Release on: push: tags: - '*' jobs: release: runs-on: ubuntu-latest if: github.repository_owner == 'voxpupuli' steps: - uses: actions/checkout@v4 - name: Install Ruby 3.1 uses: ruby/setup-ruby@v1 with: ruby-version: '3.1' env: BUNDLE_WITHOUT: release - name: Build gem run: gem build --strict --verbose *.gemspec - name: Publish gem to rubygems.org run: gem push *.gem env: GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}' - name: Setup GitHub packages access run: | mkdir -p ~/.gem echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials chmod 0600 ~/.gem/credentials - name: Publish gem to GitHub packages run: gem push --key github --host https://rubygems.pkg.github.com/${{ github.repository_owner }} *.gem puppet-syntax-4.0.0/.github/workflows/test.yml0000644000004100000410000000317214565136603021517 0ustar www-datawww-dataname: Test on: pull_request: {} push: branches: master env: BUNDLE_WITHOUT: development:release jobs: rubocop: env: BUNDLE_WITHOUT: release runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Ruby ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 with: ruby-version: "3.1" bundler-cache: true - name: Run Rubocop run: bundle exec rake rubocop test: runs-on: ubuntu-latest strategy: fail-fast: false matrix: ruby: - "3.2" - "3.1" - "3.0" - "2.7" puppet: - "~> 8.0" - "~> 7.0" - "https://github.com/puppetlabs/puppet.git#main" exclude: - ruby: "3.0" puppet: "~> 8.0" - ruby: "2.7" puppet: "~> 8.0" - ruby: "3.0" puppet: "https://github.com/puppetlabs/puppet.git#main" - ruby: "2.7" puppet: "https://github.com/puppetlabs/puppet.git#main" name: "Ruby ${{ matrix.ruby }} - Puppet ${{ matrix.puppet }}" env: PUPPET_VERSION: ${{ matrix.puppet }} steps: - uses: actions/checkout@v4 - name: Install Ruby ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Run tests run: bundle exec rake - name: Build gem run: gem build --strict --verbose *.gemspec tests: needs: - rubocop - test runs-on: ubuntu-latest name: Test suite steps: - run: echo Test suite completed puppet-syntax-4.0.0/lib/0000755000004100000410000000000014565136603015163 5ustar www-datawww-datapuppet-syntax-4.0.0/lib/puppet-syntax.rb0000644000004100000410000000145114565136603020352 0ustar www-datawww-datarequire 'puppet-syntax/version' module PuppetSyntax autoload :Hiera, 'puppet-syntax/hiera' autoload :Manifests, 'puppet-syntax/manifests' autoload :Templates, 'puppet-syntax/templates' @exclude_paths = [] @hieradata_paths = [ '**/data/**/*.*{yaml,yml}', 'hieradata/**/*.*{yaml,yml}', 'hiera*.*{yaml,yml}', ] @manifests_paths = [ '**/*.pp', ] @templates_paths = [ '**/templates/**/*.erb', '**/templates/**/*.epp', ] @fail_on_deprecation_notices = true @check_hiera_keys = false class << self attr_accessor :exclude_paths, :hieradata_paths, :manifests_paths, :templates_paths, :fail_on_deprecation_notices, :epp_only, :check_hiera_keys end end puppet-syntax-4.0.0/lib/puppet-syntax/0000755000004100000410000000000014565136603020024 5ustar www-datawww-datapuppet-syntax-4.0.0/lib/puppet-syntax/templates.rb0000644000004100000410000000552514565136603022356 0ustar www-datawww-datarequire 'erb' require 'stringio' module PuppetSyntax class Templates def check(filelist) raise 'Expected an array of files' unless filelist.is_a?(Array) # We now have to redirect STDERR in order to capture warnings. $stderr = warnings = StringIO.new result = { warnings: [], errors: [] } filelist.each do |file| if File.extname(file) == '.epp' or PuppetSyntax.epp_only tmp = validate_epp(file) elsif File.extname(file) == '.erb' tmp = validate_erb(file) end result.merge!(tmp) { |_k, a, b| a.concat(b) } unless tmp.nil? end $stderr = STDERR result[:warnings] << warnings.string unless warnings.string.empty? result[:errors].map! { |e| e.to_s } result[:warnings].map! { |w| w.to_s } result end def validate_epp(filename) require 'puppet' result = { warnings: [], errors: [] } formatter = Puppet::Pops::Validation::DiagnosticFormatterPuppetStyle.new evaluating_parser = Puppet::Pops::Parser::EvaluatingParser::EvaluatingEppParser.new parser = evaluating_parser.parser begin parse_result = parser.parse_file(filename) validation_result = evaluating_parser.validate(parse_result.model) # print out any warnings validation_result.warnings.each do |warn| message = formatter.format_message(warn) file = warn.file line = warn.source_pos.line column = warn.source_pos.pos result[:warnings] << "#{file}:#{line}:#{column}: #{message}" end # collect errors and return them in order to indicate validation failure validation_result.errors.each do |err| message = formatter.format_message(err) file = err.file line = err.source_pos.line column = err.source_pos.pos result[:errors] << "#{file}:#{line}:#{column}: #{message}" end rescue Puppet::ParseError, SyntaxError => e result[:errors] << e rescue StandardError => e result[:errors] << e end result end def validate_erb(filename) result = { warnings: [], errors: [] } begin template = File.read(filename) erb = if RUBY_VERSION >= '2.6' ERB.new(template, trim_mode: '-') else ERB.new(template, trim_mode: '-') end erb.filename = filename erb.result rescue NameError => e # This is normal because we don't have the variables that would # ordinarily be bound by the parent Puppet manifest. rescue TypeError # This is normal because we don't have the variables that would # ordinarily be bound by the parent Puppet manifest. rescue SyntaxError => e result[:errors] << e end result end end end puppet-syntax-4.0.0/lib/puppet-syntax/tasks/0000755000004100000410000000000014565136603021151 5ustar www-datawww-datapuppet-syntax-4.0.0/lib/puppet-syntax/tasks/puppet-syntax.rb0000644000004100000410000000423514565136603024343 0ustar www-datawww-datarequire 'puppet-syntax' require 'rake' require 'rake/tasklib' module PuppetSyntax class RakeTask < ::Rake::TaskLib def filelist(paths) excludes = PuppetSyntax.exclude_paths excludes.push('pkg/**/*') excludes.push('vendor/**/*') files = FileList[paths] files.reject! { |f| File.directory?(f) } files.exclude(*excludes) end def filelist_manifests filelist(PuppetSyntax.manifests_paths) end def filelist_templates filelist(PuppetSyntax.templates_paths) end def filelist_hiera_yaml filelist(PuppetSyntax.hieradata_paths) end def initialize(*_args) desc 'Syntax check Puppet manifests and templates' task syntax: [ 'syntax:manifests', 'syntax:templates', 'syntax:hiera', ] namespace :syntax do desc 'Syntax check Puppet manifests' task :manifests do |t| warn "---> #{t.name}" c = PuppetSyntax::Manifests.new output, has_errors = c.check(filelist_manifests) $stdout.puts "#{output.join("\n")}\n" unless output.empty? exit 1 if has_errors || (output.any? && PuppetSyntax.fail_on_deprecation_notices) end desc 'Syntax check Puppet templates' task :templates do |t| warn "---> #{t.name}" c = PuppetSyntax::Templates.new result = c.check(filelist_templates) unless result[:warnings].empty? $stdout.puts 'WARNINGS:' $stdout.puts result[:warnings].join("\n") end unless result[:errors].empty? warn 'ERRORS:' warn result[:errors].join("\n") exit 1 end end desc 'Syntax check Hiera config files' task hiera: [ 'syntax:hiera:yaml', ] namespace :hiera do task :yaml do |t| warn "---> #{t.name}" c = PuppetSyntax::Hiera.new errors = c.check(filelist_hiera_yaml) $stdout.puts "#{errors.join("\n")}\n" unless errors.empty? exit 1 unless errors.empty? end end end end end end PuppetSyntax::RakeTask.new puppet-syntax-4.0.0/lib/puppet-syntax/hiera.rb0000644000004100000410000000565114565136603021450 0ustar www-datawww-datarequire 'yaml' require 'base64' module PuppetSyntax class Hiera def check_hiera_key(key) if key.is_a? Symbol if key.to_s.start_with?(':') "Puppet automatic lookup will not use leading '::'" elsif !/^[a-z]+$/.match?(key) # we allow Hiera's own configuration 'Puppet automatic lookup will not look up symbols' end elsif !/^[a-z][a-z0-9_]+(::[a-z][a-z0-9_]+)*$/.match?(key) return 'Looks like a missing colon' if /[^:]:[^:]/.match?(key) # be extra helpful 'Not a valid Puppet variable name for automatic lookup' end end # Recurse through complex data structures. Return on first error. def check_eyaml_data(name, val) error = nil if val.is_a? String err = check_eyaml_blob(val) error = "Key #{name} #{err}" if err elsif val.is_a? Array val.each_with_index do |v, idx| error = check_eyaml_data("#{name}[#{idx}]", v) break if error end elsif val.is_a? Hash val.each do |k, v| error = check_eyaml_data("#{name}['#{k}']", v) break if error end end error end def check_eyaml_blob(val) return unless /^ENC\[/.match?(val) val.sub!('ENC[', '') val.gsub!(/\s+/, '') return 'has unterminated eyaml value' unless /\]$/.match?(val) val.sub!(/\]$/, '') method, base64 = val.split(',') if base64.nil? base64 = method method = 'PKCS7' end known_methods = %w[PKCS7 GPG GKMS KMS TWOFAC SecretBox VAULT GCPKMS RSA SSHAGENT VAULT_RS cli] return "has unknown eyaml method #{method}" unless known_methods.include? method return 'has unpadded or truncated base64 data' unless base64.length % 4 == 0 # Base64#decode64 will silently ignore characters outside the alphabet, # so we check resulting length of binary data instead pad_length = base64.gsub(/[^=]/, '').length return unless Base64.decode64(base64).length != (base64.length * 3 / 4) - pad_length 'has corrupt base64 data' end def check(filelist) raise 'Expected an array of files' unless filelist.is_a?(Array) errors = [] yamlargs = (Psych::VERSION >= '4.0') ? { aliases: true } : {} filelist.each do |hiera_file| begin yamldata = YAML.load_file(hiera_file, **yamlargs) rescue Exception => e errors << "ERROR: Failed to parse #{hiera_file}: #{e}" next end next unless yamldata yamldata.each do |k, v| if PuppetSyntax.check_hiera_keys key_msg = check_hiera_key(k) errors << "WARNING: #{hiera_file}: Key :#{k}: #{key_msg}" if key_msg end eyaml_msg = check_eyaml_data(k, v) errors << "WARNING: #{hiera_file}: #{eyaml_msg}" if eyaml_msg end end errors.map! { |e| e.to_s } errors end end end puppet-syntax-4.0.0/lib/puppet-syntax/manifests.rb0000644000004100000410000000422314565136603022343 0ustar www-datawww-datamodule PuppetSyntax class Manifests def check(filelist) raise 'Expected an array of files' unless filelist.is_a?(Array) require 'puppet' require 'puppet/version' require 'puppet/face' require 'puppet/test/test_helper' output = [] Puppet::Test::TestHelper.initialize Puppet::Test::TestHelper.before_all_tests called_before_all_tests = true # Catch syntax warnings. Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(output)) Puppet::Util::Log.level = :warning filelist.each do |puppet_file| Puppet::Test::TestHelper.before_each_test begin error = validate_manifest(puppet_file) output << error.values.first if error.is_a?(Hash) && !error.empty? # Puppet 6.5.0 onwards rescue SystemExit # Disregard exit(1) from face. # This is how puppet < 6.5.0 `validate_manifest` worked. rescue StandardError => e output << e ensure Puppet::Test::TestHelper.after_each_test end end Puppet::Util::Log.close_all output.map! { |e| e.to_s } # Exported resources will raise warnings when outside a puppetmaster. output.reject! do |e| e =~ /^You cannot collect( exported resources)? without storeconfigs being set/ end # tag and schedule parameters in class raise warnings notice in output that prevent from succeed output.reject! do |e| e =~ /^(tag|schedule) is a metaparam; this value will inherit to all contained resources in the / end deprecations = output.select do |e| e =~ /^Deprecation notice:|is deprecated/ end # Errors exist if there is any output that isn't a deprecation notice. has_errors = (output != deprecations) [output, has_errors] ensure Puppet::Test::TestHelper.after_all_tests if called_before_all_tests end private def validate_manifest(file) Puppet[:tasks] = true if Puppet::Util::Package.versioncmp(Puppet.version, '5.4.0') >= 0 and file.match(%r{.*plans/.*\.pp$}) Puppet::Face[:parser, :current].validate(file) end end end puppet-syntax-4.0.0/lib/puppet-syntax/version.rb0000644000004100000410000000005414565136603022035 0ustar www-datawww-datamodule PuppetSyntax VERSION = '4.0.0' end puppet-syntax-4.0.0/LICENSE.txt0000644000004100000410000000205314565136603016240 0ustar www-datawww-dataCopyright (c) 2013 Dan Carley MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. puppet-syntax-4.0.0/spec/0000755000004100000410000000000014565136603015347 5ustar www-datawww-datapuppet-syntax-4.0.0/spec/spec_helper.rb0000644000004100000410000000075114565136603020170 0ustar www-datawww-datarequire 'rspec' require 'puppet-syntax' def fixture_hiera(list) fixture_files(list, 'hiera') end def fixture_templates(list) fixture_files(list, 'test_module/templates') end def fixture_manifests(list) fixture_files(list, 'test_module/manifests') end def fixture_files(list, path) list = [list].flatten list.map { |f| File.expand_path("../fixtures/#{path}/#{f}", __FILE__) } end RSpec.configure do |config| config.color = true config.formatter = 'documentation' end puppet-syntax-4.0.0/spec/puppet-syntax_spec.rb0000644000004100000410000000237214565136603021553 0ustar www-datawww-datarequire 'spec_helper' describe PuppetSyntax do after do PuppetSyntax.exclude_paths = [] end it 'defaults exclude_paths to include the pkg directory' do expect(PuppetSyntax.exclude_paths).to include('pkg/**/*') end it 'supports setting exclude_paths' do PuppetSyntax.exclude_paths = ['foo', 'bar/baz'] expect(PuppetSyntax.exclude_paths).to eq(['foo', 'bar/baz']) end it 'supports appending exclude_paths' do PuppetSyntax.exclude_paths << 'foo' expect(PuppetSyntax.exclude_paths).to eq(['foo']) end it 'supports a fail_on_deprecation_notices setting' do PuppetSyntax.fail_on_deprecation_notices = false expect(PuppetSyntax.fail_on_deprecation_notices).to eq(false) end it 'supports forcing EPP only templates' do PuppetSyntax.epp_only = true expect(PuppetSyntax.epp_only).to eq(true) end it 'supports setting paths for manifests, templates and hiera' do PuppetSyntax.hieradata_paths = [] expect(PuppetSyntax.hieradata_paths).to eq([]) PuppetSyntax.manifests_paths = ['**/environments/production/**/*.pp'] expect(PuppetSyntax.manifests_paths).to eq(['**/environments/production/**/*.pp']) PuppetSyntax.templates_paths = [] expect(PuppetSyntax.templates_paths).to eq([]) end end puppet-syntax-4.0.0/spec/fixtures/0000755000004100000410000000000014565136603017220 5ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/hiera/0000755000004100000410000000000014565136603020310 5ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/hiera/data/0000755000004100000410000000000014565136603021221 5ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/hiera/data/hiera_1.yaml0000644000004100000410000000000014565136603023403 0ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/hiera/data/hiera_2.eyaml0000644000004100000410000000000014565136603023551 0ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/hiera/data/test/0000755000004100000410000000000014565136603022200 5ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/hiera/data/test/hiera_3.yaml0000644000004100000410000000000014565136603024364 0ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/hiera/data/test/hiera_4.eyaml0000644000004100000410000000000014565136603024532 0ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/hiera/hiera_key_empty.yaml0000644000004100000410000000000014565136603024340 0ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/hiera/hiera_good.yaml0000644000004100000410000000012514565136603023272 0ustar www-datawww-data--- :backends: - yaml :yaml: :datadir: './hieradata/good' :hierarchy: - common puppet-syntax-4.0.0/spec/fixtures/hiera/hiera_bad.eyaml0000644000004100000410000000106714565136603023243 0ustar www-datawww-data--- acme::warning1: ENC[unknown-method,aGVsbG8sIHdvcmxk] acme::warning2: ENC[PKCS7,aGVsbG8sIHdvcmxk acme::warning3: ENC[PKCS7,aGVsbG8sIHdvcmxk==] acme::warning4: ENC[PKCS7,aGVs!!!!bG8sIHdvcmxk] acme::warning5: key1: foo key2: ENC[PKCS7,aGVs!!!!bG8sIHdvcmxk] acme::warning6: hash_key: - element1 - > ENC[PKCS7, aGVsbG8sIHdvcmxk ] - > ENC[PKCS7, aGVs!!!!bG8sIHdvcmxk ] acme::good1: > ENC[PKCS7, aGVsbG8sIHdvcmxk] acme::good2: ENC[GPG,aGVsbG8sIHdvcmxkIQ==] acme::good3: ENC[GPG,aGVsbG8sIHdvcmxkISE=] puppet-syntax-4.0.0/spec/fixtures/hiera/hiera_badkey.yaml0000644000004100000410000000034214565136603023602 0ustar www-datawww-data--- this_is_ok: 0 this_is_ok::too: 0 th1s_is_ok::two3: 0 :eventhis: 0 typical:typo::warning1: true ::notsotypical::warning2: true noCamelCase::warning3: true no-hyphens::warning4: true :picky::warning5: true puppet-syntax-4.0.0/spec/fixtures/hiera/hiera_bad.yaml0000644000004100000410000000001114565136603023062 0ustar www-datawww-data%YAMLBAD puppet-syntax-4.0.0/spec/fixtures/test_module/0000755000004100000410000000000014565136603021544 5ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/test_module/templates/0000755000004100000410000000000014565136603023542 5ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/test_module/templates/pass_unbound_var.erb0000644000004100000410000000005014565136603027577 0ustar www-datawww-data<%= this_variable_has_not_been_bound %> puppet-syntax-4.0.0/spec/fixtures/test_module/templates/fail_error.epp0000644000004100000410000000010714565136603026372 0ustar www-datawww-dataThis is plain text <% This is not valid EPP %> This is also plain text puppet-syntax-4.0.0/spec/fixtures/test_module/templates/pass.erb0000644000004100000410000000007114565136603025200 0ustar www-datawww-data<% valid = 'valid' -%> This is a <%= valid -%> template. puppet-syntax-4.0.0/spec/fixtures/test_module/templates/ignore.tpl0000644000004100000410000000011014565136603025536 0ustar www-datawww-dataThis is plain text <% This is not valid Ruby %> This is also plain text puppet-syntax-4.0.0/spec/fixtures/test_module/templates/fail_error_also.epp0000644000004100000410000000006314565136603027411 0ustar www-datawww-dataThis is plain text <% } %> This is also plain text puppet-syntax-4.0.0/spec/fixtures/test_module/templates/fail_error.erb0000644000004100000410000000011014565136603026350 0ustar www-datawww-dataThis is plain text <% This is not valid Ruby %> This is also plain text puppet-syntax-4.0.0/spec/fixtures/test_module/templates/pass.epp0000644000004100000410000000011714565136603025215 0ustar www-datawww-data<%# VALID COMMENT %> <% $valid = 'valid' -%> This is a <%= $valid %> template. puppet-syntax-4.0.0/spec/fixtures/test_module/templates/fail_warning.erb0000644000004100000410000000010314565136603026666 0ustar www-datawww-dataAssignment in condition should warn. <%= "oh yes" if foo = true %> puppet-syntax-4.0.0/spec/fixtures/test_module/templates/pass_also.epp0000644000004100000410000000011714565136603026233 0ustar www-datawww-data<%# VALID COMMENT %> <% $valid = 'valid' -%> This is a <%= $valid %> template. puppet-syntax-4.0.0/spec/fixtures/test_module/templates/typeerror_shouldwin.erb0000644000004100000410000000012614565136603030362 0ustar www-datawww-data#this is valid syntax <%= File.dirname(@the_path_of_the_file_you_first_thought_of) %> puppet-syntax-4.0.0/spec/fixtures/test_module/manifests/0000755000004100000410000000000014565136603023535 5ustar www-datawww-datapuppet-syntax-4.0.0/spec/fixtures/test_module/manifests/deprecation_notice.pp0000644000004100000410000000024514565136603027735 0ustar www-datawww-datanode test inherits default { import 'pass.pp' notify { 'this should give a deprecation notice': message => 'inheritance is gone in the future parser', } } puppet-syntax-4.0.0/spec/fixtures/test_module/manifests/pass_storeconfigs.pp0000644000004100000410000000006714565136603027634 0ustar www-datawww-dataclass uses_storeconfigs { @@notify { 'exported': } } puppet-syntax-4.0.0/spec/fixtures/test_module/manifests/schedule_notice.pp0000644000004100000410000000020014565136603027223 0ustar www-datawww-dataclass schedule_parameter_test ($schedule=undef){ notify { 'schedule_should pass': message => 'with flying colours', } } puppet-syntax-4.0.0/spec/fixtures/test_module/manifests/tag_notice.pp0000644000004100000410000000016114565136603026210 0ustar www-datawww-dataclass tag_parameter_test ($tag=undef){ notify { 'tag_should pass': message => 'with flying colours', } } puppet-syntax-4.0.0/spec/fixtures/test_module/manifests/fail_warning.pp0000644000004100000410000000020214565136603026530 0ustar www-datawww-dataclass warning_puppet_module { notify { 'this should raise a warning': message => "because of \[\] escape characters", } } puppet-syntax-4.0.0/spec/fixtures/test_module/manifests/fail_error.pp0000644000004100000410000000010414565136603026215 0ustar www-datawww-dataclass failing_puppet_module { this is not a valid resource name } puppet-syntax-4.0.0/spec/fixtures/test_module/manifests/pass.pp0000644000004100000410000000015214565136603025042 0ustar www-datawww-dataclass normal_puppet_module { notify { 'should should pass': message => 'with flying colours', } } puppet-syntax-4.0.0/spec/fixtures/test_module/manifests/future_syntax.pp0000644000004100000410000000006214565136603027014 0ustar www-datawww-dataclass module_with_future_syntax { $a = $b = 10 } puppet-syntax-4.0.0/spec/fixtures/test_module/manifests/test_app.pp0000644000004100000410000000003214565136603025710 0ustar www-datawww-dataapplication test_app { } puppet-syntax-4.0.0/spec/puppet-syntax/0000755000004100000410000000000014565136603020210 5ustar www-datawww-datapuppet-syntax-4.0.0/spec/puppet-syntax/tasks/0000755000004100000410000000000014565136603021335 5ustar www-datawww-datapuppet-syntax-4.0.0/spec/puppet-syntax/tasks/puppet-syntax_spec.rb0000644000004100000410000000253714565136603025544 0ustar www-datawww-datarequire 'spec_helper' require 'puppet-syntax/tasks/puppet-syntax' known_pp = 'spec/fixtures/test_module/manifests/pass.pp' known_erb = 'spec/fixtures/test_module/templates/pass.erb' known_yaml = 'spec/fixtures/hiera/data/hiera_1.yaml' known_eyaml = 'spec/fixtures/hiera/data/hiera_2.eyaml' known_yaml_subdir = 'spec/fixtures/hiera/data/test/hiera_3.yaml' known_eyaml_subdir = 'spec/fixtures/hiera/data/test/hiera_4.eyaml' describe 'PuppetSyntax rake tasks' do it 'filters directories' do list = PuppetSyntax::RakeTask.new.filelist(['**/lib', known_pp]) expect(list.count).to eq 1 expect(list).to include(known_pp) end it 'generates FileList of manifests relative to Rakefile' do list = PuppetSyntax::RakeTask.new.filelist_manifests expect(list).to include(known_pp) expect(list.count).to eq 9 end it 'generates FileList of templates relative to Rakefile' do list = PuppetSyntax::RakeTask.new.filelist_templates expect(list).to include(known_erb) expect(list.count).to eq 9 end it 'generates FileList of Hiera yaml files relative to Rakefile' do list = PuppetSyntax::RakeTask.new.filelist_hiera_yaml expect(list).to include(known_yaml) expect(list).to include(known_eyaml) expect(list).to include(known_yaml_subdir) expect(list).to include(known_eyaml_subdir) expect(list.count).to eq 4 end end puppet-syntax-4.0.0/spec/puppet-syntax/templates_spec.rb0000644000004100000410000000715714565136603023557 0ustar www-datawww-datarequire 'spec_helper' describe PuppetSyntax::Templates do let(:subject) { PuppetSyntax::Templates.new } let(:conditional_warning_regex) do if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6.0') /2: warning: found `= literal' in conditional/ else /2: warning: found = in conditional/ end end it 'expects an array of files' do expect { subject.check(nil) }.to raise_error(/Expected an array of files/) end it 'returns nothing from a valid file' do files = fixture_templates('pass.erb') res = subject.check(files) expect(res[:warnings]).to match([]) expect(res[:errors]).to match([]) end it 'ignores NameErrors from unbound variables' do files = fixture_templates('pass_unbound_var.erb') res = subject.check(files) expect(res[:warnings]).to match([]) expect(res[:errors]).to match([]) end it 'catches SyntaxError' do files = fixture_templates('fail_error.erb') res = subject.check(files) expect(res[:errors].size).to eq(1) expect(res[:errors][0]).to match(/2: syntax error, unexpected/) end it 'catches Ruby warnings' do files = fixture_templates('fail_warning.erb') res = subject.check(files) expect(res[:warnings].size).to eq(1) expect(res[:warnings][0]).to match(conditional_warning_regex) end it 'reads more than one valid file' do files = fixture_templates(['pass.erb', 'pass_unbound_var.erb']) res = subject.check(files) expect(res[:warnings]).to match([]) expect(res[:errors]).to match([]) end it 'continues after finding an error in the first file' do files = fixture_templates(['fail_error.erb', 'fail_warning.erb']) res = subject.check(files) expect(res[:warnings].size).to eq(1) expect(res[:errors].size).to eq(1) expect(res[:errors][0]).to match(/2: syntax error, unexpected/) expect(res[:warnings][0]).to match(conditional_warning_regex) end it 'ignores a TypeError' do files = fixture_templates('typeerror_shouldwin.erb') res = subject.check(files) expect(res[:warnings]).to match([]) expect(res[:errors]).to match([]) end it 'ignores files without .erb extension' do files = fixture_templates('ignore.tpl') res = subject.check(files) expect(res[:warnings]).to match([]) expect(res[:errors]).to match([]) end it 'returns nothing from a valid file' do files = fixture_templates('pass.epp') res = subject.check(files) expect(res[:warnings]).to match([]) expect(res[:errors]).to match([]) end it 'catches SyntaxError' do files = fixture_templates('fail_error.epp') res = subject.check(files) expect(res[:errors].size).to eq(1) expect(res[:errors][0]).to match(/This Type-Name has no effect/) end it 'reads more than one valid file' do files = fixture_templates(['pass.epp', 'pass_also.epp']) res = subject.check(files) expect(res[:warnings]).to match([]) expect(res[:errors]).to match([]) end it 'continues after finding an error in the first file' do files = fixture_templates(['fail_error.epp', 'fail_error_also.epp']) res = subject.check(files) expect(res[:errors].size).to eq(2) expect(res[:errors][0]).to match(/This Type-Name has no effect/) expect(res[:errors][1]).to match(/Syntax error at '}' \(file: \S*\/fail_error_also.epp, line: 2, column: 4\)/) end context "when the 'epp_only' options is set" do before do PuppetSyntax.epp_only = true end it 'processes an ERB as EPP and find an error' do files = fixture_templates('pass.erb') res = subject.check(files) expect(res[:errors].size).to eq(1) end end end puppet-syntax-4.0.0/spec/puppet-syntax/manifests_spec.rb0000644000004100000410000000626614565136603023552 0ustar www-datawww-datarequire 'spec_helper' require 'puppet' describe PuppetSyntax::Manifests do let(:subject) { PuppetSyntax::Manifests.new } it 'expects an array of files' do expect { subject.check(nil) }.to raise_error(/Expected an array of files/) end it 'returns nothing from a valid file' do files = fixture_manifests('pass.pp') output, has_errors = subject.check(files) expect(output).to eq([]) expect(has_errors).to eq(false) end it 'returns nothing from a valid file with a class using tag parameter' do files = fixture_manifests('tag_notice.pp') output, has_errors = subject.check(files) expect(output).to eq([]) expect(has_errors).to eq(false) end it 'returns nothing from a valid file with a class using schedule parameter' do files = fixture_manifests('schedule_notice.pp') output, has_errors = subject.check(files) expect(output).to eq([]) expect(has_errors).to eq(false) end it 'returns an error from an invalid file' do files = fixture_manifests('fail_error.pp') output, has_errors = subject.check(files) expect(output.size).to eq(3) expect(output[2]).to match(/2 errors. Giving up/) expect(has_errors).to eq(true) end it 'returns a warning from an invalid file' do files = fixture_manifests('fail_warning.pp') output, has_errors = subject.check(files) expect(output.size).to eq(2) expect(has_errors).to eq(true) expect(output[0]).to match(/Unrecogni(s|z)ed escape sequence '\\\['/) expect(output[1]).to match(/Unrecogni(s|z)ed escape sequence '\\\]'/) end it 'ignores warnings about storeconfigs' do files = fixture_manifests('pass_storeconfigs.pp') output, has_errors = subject.check(files) expect(output).to eq([]) expect(has_errors).to eq(false) end it 'reads more than one valid file' do files = fixture_manifests(['pass.pp', 'pass_storeconfigs.pp']) output, has_errors = subject.check(files) expect(output).to eq([]) expect(has_errors).to eq(false) end it 'continues after finding an error in the first file' do files = fixture_manifests(['fail_error.pp', 'fail_warning.pp']) output, has_errors = subject.check(files) expect(has_errors).to eq(true) expect(output.size).to eq(5) expect(output[0]).to match(%r{This Name has no effect. A Host Class Definition can not end with a value-producing expression without other effect \(file: \S*/fail_error.pp, line: 2, column: 32\)$}) expect(output[1]).to match(%r{This Name has no effect. A value was produced and then forgotten \(one or more preceding expressions may have the wrong form\) \(file: \S*/fail_error.pp, line: 2, column: 3\)$}) expect(output[2]).to match('2 errors. Giving up') expect(output[3]).to match(/Unrecogni(s|z)ed escape sequence '\\\['/) expect(output[4]).to match(/Unrecogni(s|z)ed escape sequence '\\\]'/) end describe 'deprecation notices' do it 'insteads be failures' do files = fixture_manifests('deprecation_notice.pp') output, has_errors = subject.check(files) expect(has_errors).to eq(true) expect(output.size).to eq(1) expect(output[0]).to match(/Node inheritance is not supported in Puppet >= 4.0.0/) end end end puppet-syntax-4.0.0/spec/puppet-syntax/hiera_spec.rb0000644000004100000410000000506514565136603022645 0ustar www-datawww-datarequire 'spec_helper' describe PuppetSyntax::Hiera do let(:subject) { PuppetSyntax::Hiera.new } it 'expects an array of files' do expect { subject.check(nil) }.to raise_error(/Expected an array of files/) end it 'returns nothing from valid YAML' do files = fixture_hiera('hiera_good.yaml') res = subject.check(files) expect(res).to eq [] end it 'returns an error from invalid YAML' do files = fixture_hiera('hiera_bad.yaml') expected = /ERROR: Failed to parse #{files[0]}:/ res = subject.check(files) expect(res.size).to eq 1 expect(res.first).to match(expected) end context 'check_hiera_keys = true' do before do PuppetSyntax.check_hiera_keys = true end it 'returns warnings for invalid keys' do hiera_yaml = 'hiera_badkey.yaml' examples = 5 files = fixture_hiera(hiera_yaml) res = subject.check(files) (1..examples).each do |n| expect(res).to include(/::warning#{n}/) end expect(res.size).to eq examples expect(res[0]).to match('Key :typical:typo::warning1: Looks like a missing colon') expect(res[1]).to match('Key ::notsotypical::warning2: Puppet automatic lookup will not use leading \'::\'') expect(res[2]).to match('Key :noCamelCase::warning3: Not a valid Puppet variable name for automatic lookup') expect(res[3]).to match('Key :no-hyphens::warning4: Not a valid Puppet variable name for automatic lookup') expect(res[4]).to match('Key :picky::warning5: Puppet automatic lookup will not look up symbols') end it 'returns warnings for bad eyaml values' do hiera_yaml = 'hiera_bad.eyaml' examples = 6 files = fixture_hiera(hiera_yaml) res = subject.check(files) (1..examples).each do |n| expect(res).to include(/::warning#{n}/) end expect(res.size).to eq examples expect(res[0]).to match('Key acme::warning1 has unknown eyaml method unknown-method') expect(res[1]).to match('Key acme::warning2 has unterminated eyaml value') expect(res[2]).to match('Key acme::warning3 has unpadded or truncated base64 data') expect(res[3]).to match('Key acme::warning4 has corrupt base64 data') expect(res[4]).to match('Key acme::warning5\[\'key2\'\] has corrupt base64 data') expect(res[5]).to match('Key acme::warning6\[\'hash_key\'\]\[2\] has corrupt base64 data') end it 'handles empty files' do hiera_yaml = 'hiera_key_empty.yaml' files = fixture_hiera(hiera_yaml) res = subject.check(files) expect(res).to be_empty end end end puppet-syntax-4.0.0/Rakefile0000644000004100000410000000215214565136603016062 0ustar www-datawww-datarequire 'rspec/core/rake_task' RSpec::Core::RakeTask.new('spec') task :publish_gem do require 'gem_publisher' gem = GemPublisher.publish_if_updated('puppet-syntax.gemspec', :rubygems) puts "Published #{gem}" if gem end task default: [:spec] begin require 'github_changelog_generator/task' require 'puppet-syntax/version' GitHubChangelogGenerator::RakeTask.new :changelog do |config| version = PuppetSyntax::VERSION config.future_release = "v#{version}" if /^\d+\.\d+.\d+$/.match?(version) config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file." config.exclude_labels = %w[duplicate question invalid wontfix wont-fix modulesync skip-changelog github_actions] config.user = 'voxpupuli' config.project = 'puppet-syntax' end rescue LoadError end begin require 'rubocop/rake_task' rescue LoadError # RuboCop is an optional group else RuboCop::RakeTask.new(:rubocop) do |task| # These make the rubocop experience maybe slightly less terrible task.options = ['--display-cop-names', '--display-style-guide', '--extra-details'] end end puppet-syntax-4.0.0/HISTORY.md0000644000004100000410000001243714565136603016107 0ustar www-datawww-data## [v2.4.2](https://github.com/voxpupuli/puppet-syntax/tree/v2.4.2) (2019-02-08) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.4.1...v2.4.2) - Search manifests in manifests directory - Allow .yml as an extension for YAML files. - Ensure the pkg directory is always excluded - Check consistency of ENC blobs in eyaml data ## [v2.4.1](https://github.com/voxpupuli/puppet-syntax/tree/v2.4.1) (2017-06-29) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.4.0...v2.4.1) - Fix to ensure namespace scope is inherited. - Cleanly exits when syntax warnings/errors are found instead of failing. ## [v2.4.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.4.0) (2017-03-14) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.3.0...v2.4.0) - Add check_hiera_keys flag for deep checking of Hiera key name correctness. Thanks @petems. - Fix Puppet version comparisons for compatibility with Puppet 4.10. - Fix app_management setting compatibility with Puppet 5. - Refactor PUPPETVERSION usage to Puppet.version public API. ## [v2.3.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.3.0) (2017-02-01) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.2.0...v2.3.0) - Add app_management flag for Puppet application orchestration support. Thanks @ipcrm. - Check all *yaml file extensions, including eyaml. thanks @kjetilho, @rjw1. - Only test ERB syntax in files with an *.erb extension. Thanks @alexiri. - Extend README to list specific files and checks implemented. Thanks @petems. - Refactor Rake filelist generation, add tests. Thanks @kjetilho, @rjw1. ## [v2.2.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.2.0) (2016-12-02) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.1.1...v2.2.0) - Replace Puppet.initialize_settings with Puppet::Test::TestHelper. Thanks @domcleal #60 This clears out caches on every test so increases runtime. ## [v2.1.1](https://github.com/voxpupuli/puppet-syntax/tree/v2.1.1) (2016-10-21) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.1.0...v2.1.1) - Use `$stderr.puts` rather than `warn` and `info` (thanks @mmckinst) - Allow latest 3.x to validate EPP files (thanks @DavidS) ## [v2.1.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.1.0) (2016-01-18) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.0.0...v2.1.0) - Support Puppet 4. Many thanks to @DavidS - Support validation of EPP templates. Thanks to @trlinkin - Test improvements and refactoring, including Travis CI tests against Puppet 4. Thanks to @trlinkin - Don't error when a tag metaparameter is present. Thank you @dhardy92 - Report the filename of invalid hiera data files. Thanks @danzilio ## [v2.0.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.0.0) (2015-02-26) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.4.1...v2.0.0) - Removed support for Puppet version 2.7.x - New option, fail_on_deprecation_notices, which defaults to true (compatible with previous behaviour); thanks @pcfens - PuppetSyntax::Manifests#check now has two return arguments ## [v1.4.1](https://github.com/voxpupuli/puppet-syntax/tree/v1.4.1) (2015-01-08) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.4.0...v1.4.1) - Support appending to config arrays, thanks @domcleal ## [v1.4.0](https://github.com/voxpupuli/puppet-syntax/tree/v1.4.0) (2014-12-18) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.3.0...v1.4.0) - Rspec 3 is now supported, thanks @tuxmea - Build error fixed where gem_publisher was used prematurely - Lazy load Puppet only when it's required, thanks @logicminds ## [v1.3.0](https://github.com/voxpupuli/puppet-syntax/tree/v1.3.0) (2014-08-07) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.2.3...v1.3.0) - Add the ability to pass hieradata_paths array of globs to check - Check hieradata in modules ('**/data/**/*.yaml') by default ## [v1.2.3](https://github.com/voxpupuli/puppet-syntax/tree/v1.2.3) (2014-08-06) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.2.2...v1.2.3) - Fix puppetlabs_spec_helper warning on Ruby 1.8 ## [v1.2.2](https://github.com/voxpupuli/puppet-syntax/tree/v1.2.2) (2014-07-31) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.2.0...v1.2.2) - Check and document conflicts with puppetlabs_spec_helper <= 0.7.0 ## v1.2.1 (2014-07-23) - Remove dependency on Puppet from Gemspec (for Puppet Entreprise users). ## v1.2.0 (2014-03-28) - Optional support for Puppet's future parser. ## v1.1.1 (2014-03-17) - Ignore exit(1) from Puppet 3.4 - Don't use hardcoded version of parser face. ## v1.1.0 (2013-09-06) - Syntax checks for Hiera YAML files. - Improved documentation. ## v1.0.0 (2013-07-04) - Refactor code to make it easier to test. - Implement spec tests for syntax checks. - Pending spec tests for FileList matching. - Matrix tests for other Ruby/Puppet versions. - Improve usage example in README. ## v0.0.4 (2013-06-14) - Fix `$confdir` error for Puppet 3.x ## v0.0.3 (2013-06-11) - List rake as a dependency. - Output names of tasks to STDERR. - Match template paths correctly. - Add pending spec tests, not yet working. ## v0.0.2 (2013-06-10) - Fix namespacing of rake tasks. ## v0.0.1 (2013-06-10) - Initial release puppet-syntax-4.0.0/.rubocop_todo.yml0000644000004100000410000001727114565136603017724 0ustar www-datawww-data# This configuration was generated by # `rubocop --auto-gen-config` # on 2024-02-07 19:46:27 UTC using RuboCop version 1.60.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. # Offense count: 2 # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. Lint/DuplicateBranch: Exclude: - 'lib/puppet-syntax/templates.rb' # Offense count: 1 # Configuration parameters: AllowedParentClasses. Lint/MissingSuper: Exclude: - 'lib/puppet-syntax/tasks/puppet-syntax.rb' # Offense count: 1 Lint/RescueException: Exclude: - 'lib/puppet-syntax/hiera.rb' # Offense count: 1 # Configuration parameters: AllowComments, AllowNil. Lint/SuppressedException: Exclude: - 'Rakefile' # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Lint/UselessAssignment: Exclude: - 'lib/puppet-syntax/templates.rb' # Offense count: 4 # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. # CheckDefinitionPathHierarchyRoots: lib, spec, test, src # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS Naming/FileName: Exclude: - 'lib/puppet-syntax.rb' - 'lib/puppet-syntax/tasks/puppet-syntax.rb' - 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb' - 'spec/puppet-syntax_spec.rb' # Offense count: 11 # This cop supports unsafe autocorrection (--autocorrect-all). RSpec/BeEq: Exclude: - 'spec/puppet-syntax/manifests_spec.rb' - 'spec/puppet-syntax_spec.rb' # Offense count: 1 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without RSpec/ContextWording: Exclude: - 'spec/puppet-syntax/hiera_spec.rb' # Offense count: 1 # Configuration parameters: IgnoredMetadata. RSpec/DescribeClass: Exclude: - '**/spec/features/**/*' - '**/spec/requests/**/*' - '**/spec/routing/**/*' - '**/spec/system/**/*' - '**/spec/views/**/*' - 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb' # Offense count: 19 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: SkipBlocks, EnforcedStyle. # SupportedStyles: described_class, explicit RSpec/DescribedClass: Exclude: - 'spec/puppet-syntax/hiera_spec.rb' - 'spec/puppet-syntax/manifests_spec.rb' - 'spec/puppet-syntax/templates_spec.rb' - 'spec/puppet-syntax_spec.rb' # Offense count: 7 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 14 # Offense count: 4 # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. # Include: **/*_spec*rb*, **/spec/**/* RSpec/FilePath: Exclude: - 'spec/puppet-syntax/hiera_spec.rb' - 'spec/puppet-syntax/manifests_spec.rb' - 'spec/puppet-syntax/templates_spec.rb' - 'spec/puppet-syntax_spec.rb' # Offense count: 29 RSpec/MultipleExpectations: Max: 8 # Offense count: 30 # Configuration parameters: EnforcedStyle, IgnoreSharedExamples. # SupportedStyles: always, named_only RSpec/NamedSubject: Exclude: - 'spec/puppet-syntax/hiera_spec.rb' - 'spec/puppet-syntax/manifests_spec.rb' - 'spec/puppet-syntax/templates_spec.rb' # Offense count: 8 RSpec/RepeatedDescription: Exclude: - 'spec/puppet-syntax/templates_spec.rb' # Offense count: 4 # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata. # Include: **/*_spec.rb RSpec/SpecFilePathFormat: Exclude: - '**/spec/routing/**/*' - 'spec/puppet-syntax/hiera_spec.rb' - 'spec/puppet-syntax/manifests_spec.rb' - 'spec/puppet-syntax/templates_spec.rb' - 'spec/puppet-syntax_spec.rb' # Offense count: 3 RSpec/SubjectDeclaration: Exclude: - 'spec/puppet-syntax/hiera_spec.rb' - 'spec/puppet-syntax/manifests_spec.rb' - 'spec/puppet-syntax/templates_spec.rb' # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Rake/Desc: Exclude: - 'Rakefile' # Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: always, conditionals Style/AndOr: Exclude: - 'lib/puppet-syntax/manifests.rb' - 'lib/puppet-syntax/templates.rb' # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: MinBranchesCount. Style/CaseLikeIf: Exclude: - 'lib/puppet-syntax/hiera.rb' # Offense count: 5 # Configuration parameters: AllowedConstants. Style/Documentation: Exclude: - 'spec/**/*' - 'test/**/*' - 'lib/puppet-syntax.rb' - 'lib/puppet-syntax/hiera.rb' - 'lib/puppet-syntax/manifests.rb' - 'lib/puppet-syntax/tasks/puppet-syntax.rb' - 'lib/puppet-syntax/templates.rb' # Offense count: 15 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never Style/FrozenStringLiteralComment: Exclude: - 'Gemfile' - 'Rakefile' - 'lib/puppet-syntax.rb' - 'lib/puppet-syntax/hiera.rb' - 'lib/puppet-syntax/manifests.rb' - 'lib/puppet-syntax/tasks/puppet-syntax.rb' - 'lib/puppet-syntax/templates.rb' - 'lib/puppet-syntax/version.rb' - 'puppet-syntax.gemspec' - 'spec/puppet-syntax/hiera_spec.rb' - 'spec/puppet-syntax/manifests_spec.rb' - 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb' - 'spec/puppet-syntax/templates_spec.rb' - 'spec/puppet-syntax_spec.rb' - 'spec/spec_helper.rb' # Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). Style/IdenticalConditionalBranches: Exclude: - 'lib/puppet-syntax/templates.rb' # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: literals, strict Style/MutableConstant: Exclude: - 'lib/puppet-syntax/version.rb' # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns. # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: - 'spec/**/*' - 'lib/puppet-syntax/hiera.rb' # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, AllowInnerSlashes. # SupportedStyles: slashes, percent_r, mixed Style/RegexpLiteral: Exclude: - 'spec/puppet-syntax/templates_spec.rb' # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Style/SelectByRegexp: Exclude: - 'lib/puppet-syntax/manifests.rb' # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: RequireEnglish, EnforcedStyle. # SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names Style/SpecialGlobalVars: Exclude: - 'puppet-syntax.gemspec' # Offense count: 4 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. # AllowedMethods: define_method Style/SymbolProc: Exclude: - 'lib/puppet-syntax/hiera.rb' - 'lib/puppet-syntax/manifests.rb' - 'lib/puppet-syntax/templates.rb' # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: Max: 211 puppet-syntax-4.0.0/Gemfile0000644000004100000410000000214414565136603015711 0ustar www-datawww-datasource 'https://rubygems.org' # Find a location or specific version for a gem. place_or_version can be a # version, which is most often used. It can also be git, which is specified as # `git://somewhere.git#branch`. You can also use a file source location, which # is specified as `file://some/location/on/disk`. def location_for(place_or_version, fake_version = nil) if place_or_version =~ /^(https[:@][^#]*)#(.*)/ [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact elsif place_or_version =~ %r{^file://(.*)} ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }] else [place_or_version, { require: false }] end end # Specify your gem's dependencies in puppet-syntax.gemspec gemspec # Override gemspec for CI matrix builds. # But only if the environment variable is set gem 'puppet', *location_for(ENV['PUPPET_VERSION']) if ENV['PUPPET_VERSION'] group :test do gem 'rspec' end group :release, optional: true do gem 'faraday-retry', '~> 2.1', require: false gem 'github_changelog_generator', '~> 1.16.4', require: false end puppet-syntax-4.0.0/puppet-syntax.gemspec0000644000004100000410000000204014565136603020617 0ustar www-datawww-datalib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'puppet-syntax/version' Gem::Specification.new do |spec| spec.name = 'puppet-syntax' spec.version = PuppetSyntax::VERSION spec.authors = ['Vox Pupuli'] spec.email = ['voxpupuli@groups.io'] spec.description = 'Syntax checks for Puppet manifests and templates' spec.summary = 'Syntax checks for Puppet manifests, templates, and Hiera YAML' spec.homepage = 'https://github.com/voxpupuli/puppet-syntax' spec.license = 'MIT' spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ['lib'] spec.required_ruby_version = '>= 2.7' spec.add_dependency 'puppet', '>= 7', '< 9' spec.add_dependency 'rake', '~> 13.1' spec.add_development_dependency 'pry', '~> 0.14.2' spec.add_development_dependency 'rb-readline', '~> 0.5.5' spec.add_development_dependency 'voxpupuli-rubocop', '~> 2.4.0' end puppet-syntax-4.0.0/README.md0000644000004100000410000001172714565136603015704 0ustar www-datawww-data# puppet-syntax [![License](https://img.shields.io/github/license/voxpupuli/puppet-syntax.svg)](https://github.com/voxpupuli/puppet-syntax/blob/master/LICENSE.txt) [![Release](https://github.com/voxpupuli/puppet-syntax/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-syntax/actions/workflows/release.yml) [![Test](https://github.com/voxpupuli/puppet-syntax/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/puppet-syntax/actions/workflows/test.yml) [![RubyGem Version](https://img.shields.io/gem/v/puppet-syntax.svg)](https://rubygems.org/gems/puppet-syntax) [![RubyGem Downloads](https://img.shields.io/gem/dt/puppet-syntax.svg)](https://rubygems.org/gems/puppet-syntax) # Puppet::Syntax Puppet::Syntax checks for correct syntax in Puppet manifests, templates, and Hiera YAML. ## Version support Puppet::Syntax is supported with: - Puppet >= 5.0 that provides the `validate` face. - Ruby >= 2.4 For the specific versions that we test against, see the [GitHub Actions workflow](.github/workflows/test.yml). ## Installation To install Puppet::Syntax, either add it to your module's Gemfile or install the gem manually. * To install with the Gemfile, add: ```ruby gem 'puppet-syntax' ``` And then execute: ```sh bundle install ``` * To install the gem yourself, run: ```sh gem install puppet-syntax ``` ## Configuration To configure Puppet::Syntax, add any of the following settings to your `Rakefile`. * To exclude certain paths from the syntax checks, set: ```ruby PuppetSyntax.exclude_paths = ["vendor/**/*"] ``` * To configure specific paths for the Hiera syntax check, specify `hieradata_paths`. This is useful if you use Hiera data inside your module. ```ruby PuppetSyntax.hieradata_paths = ["**/data/**/*.yaml", "hieradata/**/*.yaml", "hiera*.yaml"] ``` * To configure specific paths for the Puppet syntax checks or for the templates checks, specify `manifests_paths` or `templates_paths` respectively. This is useful if you want to check specific paths only. ```ruby PuppetSyntax.manifests_paths = ["**/environments/future/*.pp"] PuppetSyntax.templates_paths = ["**/modules/**/templates/*.erb"] ``` * To ignore deprecation warnings, disable `fail_on_deprecation_notices`. By default, `puppet-syntax` fails if it encounters Puppet deprecation notices. If you are working with a legacy code base and want to ignore such non-fatal warnings, you might want to override the default behavior. ```ruby PuppetSyntax.fail_on_deprecation_notices = false ``` * To enable a syntax check on Hiera keys, set: ```ruby PuppetSyntax.check_hiera_keys = true ``` This reports common mistakes in key names in Hiera files, such as: * Leading `::` in keys, such as: `::notsotypical::warning2: true`. * Single colon scope separators, such as: `:picky::warning5: true`. * Invalid camel casing, such as: `noCamelCase::warning3: true`. * Use of hyphens, such as: `no-hyphens::warning4: true`. ## Usage * To enable Puppet::Syntax, include the following in your module's `Rakefile`: ```ruby require 'puppet-syntax/tasks/puppet-syntax' ``` For Continuous Integration, use Puppet::Syntax in conjunction with `puppet-lint` and spec tests. Add the following to your module's `Rakefile`: ```ruby task :test => [ :syntax, :lint, :spec, ] ``` * To test all manifests and templates, relative to the location of the `Rakefile`, run: ``` $ bundle exec rake syntax ---> syntax:manifests ---> syntax:templates ---> syntax:hiera:yaml ``` * To return a non-zero exit code and an error message on any failures, run: ``` $ bundle exec rake syntax ---> syntax:manifests rake aborted! Could not parse for environment production: Syntax error at end of file at demo.pp:2 Tasks: TOP => syntax => syntax:manifests (See full trace by running task with --trace) ``` ## Checks Puppet::Syntax makes the following checks in the directories and subdirectories of the module, relative to the location of the `Rakefile`. ### Hiera Checks `.yaml` files for syntax errors. By default, this rake task looks for all `.yaml` files in a single module under: * `**/data/**/*.yaml` * `hieradata/**/*.yaml` * `hiera*.yaml` ### manifests Checks all `.pp` files in the module for syntax errors. ### templates #### erb Checks `.erb` files in the module for syntax errors. #### epp Checks `.epp` files in the module for syntax errors. EPP checks are supported in Puppet 4 or greater, or in Puppet 3 with the future parser enabled. ## Contributing 1. Fork the repo. 2. Create your feature branch (`git checkout -b my-new-feature`). 3. Commit your changes (`git commit -am 'Add some feature'`). 4. Push to the branch (`git push origin my-new-feature`). 5. Create new Pull Request. ## Making a new Release * Update version in `lib/puppet-syntax/version.rb` * Run the changelog rake task (bundle exec rake changelog) * Create a PR * Get it reviewed and merged * update the local repo, create a signed git tag, prefixed with a v, matching the new version (git tag -s v1.2.3) * GitHub action will publish to GitHub Packages and Rubygems puppet-syntax-4.0.0/.rubocop.yml0000644000004100000410000000015614565136603016671 0ustar www-datawww-data--- inherit_from: .rubocop_todo.yml inherit_gem: voxpupuli-rubocop: rubocop.yml Metrics: Enabled: false puppet-syntax-4.0.0/CHANGELOG.md0000644000004100000410000003171014565136603016230 0ustar www-datawww-data# Changelog All notable changes to this project will be documented in this file. ## [v4.0.0](https://github.com/voxpupuli/puppet-syntax/tree/v4.0.0) (2024-02-07) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v3.3.0...v4.0.0) **Breaking changes:** - Drop Ruby 2.4/2.5/2.6 & Puppet 5/6 support [\#145](https://github.com/voxpupuli/puppet-syntax/pull/145) ([bastelfreak](https://github.com/bastelfreak)) **Implemented enhancements:** - Add Ruby 3.2 / Puppet 8 support [\#147](https://github.com/voxpupuli/puppet-syntax/pull/147) ([bastelfreak](https://github.com/bastelfreak)) - support aliases in hiera yaml [\#144](https://github.com/voxpupuli/puppet-syntax/pull/144) ([akerl](https://github.com/akerl)) - Implement RuboCop [\#137](https://github.com/voxpupuli/puppet-syntax/pull/137) ([bastelfreak](https://github.com/bastelfreak)) **Fixed bugs:** - fix "NameError: uninitialized constant Puppet::Util" [\#155](https://github.com/voxpupuli/puppet-syntax/pull/155) ([mxey](https://github.com/mxey)) - add all known hiera-eyaml methods [\#154](https://github.com/voxpupuli/puppet-syntax/pull/154) ([mxey](https://github.com/mxey)) **Merged pull requests:** - README.md: Fix badges [\#161](https://github.com/voxpupuli/puppet-syntax/pull/161) ([bastelfreak](https://github.com/bastelfreak)) - gemspec: Add version requirements & CI: Build Gems ins strict & verbose mode [\#160](https://github.com/voxpupuli/puppet-syntax/pull/160) ([bastelfreak](https://github.com/bastelfreak)) - Update voxpupuli-rubocop requirement from ~\> 2.0.0 to ~\> 2.4.0 [\#159](https://github.com/voxpupuli/puppet-syntax/pull/159) ([dependabot[bot]](https://github.com/apps/dependabot)) - Update voxpupuli-rubocop requirement from ~\> 1.4.0 to ~\> 2.0.0 [\#152](https://github.com/voxpupuli/puppet-syntax/pull/152) ([dependabot[bot]](https://github.com/apps/dependabot)) - GCG: Add faraday-retry dep [\#149](https://github.com/voxpupuli/puppet-syntax/pull/149) ([bastelfreak](https://github.com/bastelfreak)) - Switch to voxpupuli-rubocop [\#148](https://github.com/voxpupuli/puppet-syntax/pull/148) ([bastelfreak](https://github.com/bastelfreak)) - CI: add dummy job to depend on [\#146](https://github.com/voxpupuli/puppet-syntax/pull/146) ([bastelfreak](https://github.com/bastelfreak)) - Drop Ruby 1.8 testcode [\#142](https://github.com/voxpupuli/puppet-syntax/pull/142) ([bastelfreak](https://github.com/bastelfreak)) - rubocop: fix whitespace and newline warnings [\#141](https://github.com/voxpupuli/puppet-syntax/pull/141) ([bastelfreak](https://github.com/bastelfreak)) - rubocop: fix trailing comma [\#140](https://github.com/voxpupuli/puppet-syntax/pull/140) ([bastelfreak](https://github.com/bastelfreak)) ## [v3.3.0](https://github.com/voxpupuli/puppet-syntax/tree/v3.3.0) (2023-02-08) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v3.2.1...v3.3.0) **Implemented enhancements:** - Lazy load required classes [\#134](https://github.com/voxpupuli/puppet-syntax/pull/134) ([ekohl](https://github.com/ekohl)) **Merged pull requests:** - Pull in Puppet 6.29 in CI [\#135](https://github.com/voxpupuli/puppet-syntax/pull/135) ([ekohl](https://github.com/ekohl)) ## [v3.2.1](https://github.com/voxpupuli/puppet-syntax/tree/v3.2.1) (2022-05-16) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v3.2.0...v3.2.1) ## [v3.2.0](https://github.com/voxpupuli/puppet-syntax/tree/v3.2.0) (2022-05-16) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v3.1.0...v3.2.0) **Implemented enhancements:** - Remove AppVeyor testing [\#94](https://github.com/voxpupuli/puppet-syntax/issues/94) - Convert from Travis CI to GitHub Actions [\#130](https://github.com/voxpupuli/puppet-syntax/pull/130) ([ekohl](https://github.com/ekohl)) **Fixed bugs:** - Add missing `$` in github action [\#132](https://github.com/voxpupuli/puppet-syntax/pull/132) ([bastelfreak](https://github.com/bastelfreak)) ## [v3.1.0](https://github.com/voxpupuli/puppet-syntax/tree/v3.1.0) (2020-06-24) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v3.0.1...v3.1.0) **Implemented enhancements:** - print actual template errors on $stderr [\#125](https://github.com/voxpupuli/puppet-syntax/pull/125) ([foxxx0](https://github.com/foxxx0)) **Merged pull requests:** - Add ruby2.7 testing, replacing multiple obsolete puppet6 versions [\#124](https://github.com/voxpupuli/puppet-syntax/pull/124) ([DavidS](https://github.com/DavidS)) ## [v3.0.1](https://github.com/voxpupuli/puppet-syntax/tree/v3.0.1) (2020-05-27) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v3.0.0...v3.0.1) **Merged pull requests:** - Avoid failure on schedule metaparameter warning [\#122](https://github.com/voxpupuli/puppet-syntax/pull/122) ([ffapitalle](https://github.com/ffapitalle)) ## [v3.0.0](https://github.com/voxpupuli/puppet-syntax/tree/v3.0.0) (2020-05-09) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.6.1...v3.0.0) **Breaking changes:** - Drop legacy code to support Puppet \< 5 and Ruby \< 2.4 [\#120](https://github.com/voxpupuli/puppet-syntax/pull/120) ([ekohl](https://github.com/ekohl)) **Implemented enhancements:** - Migrate Changelog to GCG [\#93](https://github.com/voxpupuli/puppet-syntax/issues/93) **Merged pull requests:** - cleanup README.md / fix markdown linter warnings [\#119](https://github.com/voxpupuli/puppet-syntax/pull/119) ([bastelfreak](https://github.com/bastelfreak)) ## [v2.6.1](https://github.com/voxpupuli/puppet-syntax/tree/v2.6.1) (2020-01-11) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.6.0...v2.6.1) **Fixed bugs:** - Add `puppet` gem as runtime dependency [\#116](https://github.com/voxpupuli/puppet-syntax/pull/116) ([bastelfreak](https://github.com/bastelfreak)) **Merged pull requests:** - traivs: run tests on Ubuntu 18.04 [\#117](https://github.com/voxpupuli/puppet-syntax/pull/117) ([bastelfreak](https://github.com/bastelfreak)) - travis: enable irc / disable email notifications [\#114](https://github.com/voxpupuli/puppet-syntax/pull/114) ([bastelfreak](https://github.com/bastelfreak)) ## [v2.6.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.6.0) (2019-10-05) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.5.0...v2.6.0) **Implemented enhancements:** - add support for validating puppet plans \(fixes \#95, fixes \#96\) [\#97](https://github.com/voxpupuli/puppet-syntax/pull/97) ([slauger](https://github.com/slauger)) - Allow specifying file paths for manifests and templates too [\#87](https://github.com/voxpupuli/puppet-syntax/pull/87) ([lavagetto](https://github.com/lavagetto)) **Merged pull requests:** - Test on ruby 2.6 [\#111](https://github.com/voxpupuli/puppet-syntax/pull/111) ([alexjfisher](https://github.com/alexjfisher)) - Adding KMS tags to allowed EYAML methods [\#105](https://github.com/voxpupuli/puppet-syntax/pull/105) ([craigwatson](https://github.com/craigwatson)) ## [v2.5.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.5.0) (2019-07-07) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.4.3...v2.5.0) **Implemented enhancements:** - Support puppet 6.5 [\#106](https://github.com/voxpupuli/puppet-syntax/pull/106) ([alexjfisher](https://github.com/alexjfisher)) ## [v2.4.3](https://github.com/voxpupuli/puppet-syntax/tree/v2.4.3) (2019-02-09) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.4.2...v2.4.3) **Fixed bugs:** - Revert "search manifests in manifests directory" [\#102](https://github.com/voxpupuli/puppet-syntax/pull/102) ([alexjfisher](https://github.com/alexjfisher)) ## [v2.4.2](https://github.com/voxpupuli/puppet-syntax/tree/v2.4.2) (2019-02-08) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.4.1...v2.4.2) - Search manifests in manifests directory - Allow .yml as an extension for YAML files. - Ensure the pkg directory is always excluded - Check consistency of ENC blobs in eyaml data ## [v2.4.1](https://github.com/voxpupuli/puppet-syntax/tree/v2.4.1) (2017-06-29) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.4.0...v2.4.1) - Fix to ensure namespace scope is inherited. - Cleanly exits when syntax warnings/errors are found instead of failing. ## [v2.4.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.4.0) (2017-03-14) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.3.0...v2.4.0) - Add check_hiera_keys flag for deep checking of Hiera key name correctness. Thanks @petems. - Fix Puppet version comparisons for compatibility with Puppet 4.10. - Fix app_management setting compatibility with Puppet 5. - Refactor PUPPETVERSION usage to Puppet.version public API. ## [v2.3.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.3.0) (2017-02-01) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.2.0...v2.3.0) - Add app_management flag for Puppet application orchestration support. Thanks @ipcrm. - Check all *yaml file extensions, including eyaml. thanks @kjetilho, @rjw1. - Only test ERB syntax in files with an *.erb extension. Thanks @alexiri. - Extend README to list specific files and checks implemented. Thanks @petems. - Refactor Rake filelist generation, add tests. Thanks @kjetilho, @rjw1. ## [v2.2.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.2.0) (2016-12-02) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.1.1...v2.2.0) - Replace Puppet.initialize_settings with Puppet::Test::TestHelper. Thanks @domcleal #60 This clears out caches on every test so increases runtime. ## [v2.1.1](https://github.com/voxpupuli/puppet-syntax/tree/v2.1.1) (2016-10-21) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.1.0...v2.1.1) - Use `$stderr.puts` rather than `warn` and `info` (thanks @mmckinst) - Allow latest 3.x to validate EPP files (thanks @DavidS) ## [v2.1.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.1.0) (2016-01-18) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v2.0.0...v2.1.0) - Support Puppet 4. Many thanks to @DavidS - Support validation of EPP templates. Thanks to @trlinkin - Test improvements and refactoring, including Travis CI tests against Puppet 4. Thanks to @trlinkin - Don't error when a tag metaparameter is present. Thank you @dhardy92 - Report the filename of invalid hiera data files. Thanks @danzilio ## [v2.0.0](https://github.com/voxpupuli/puppet-syntax/tree/v2.0.0) (2015-02-26) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.4.1...v2.0.0) - Removed support for Puppet version 2.7.x - New option, fail_on_deprecation_notices, which defaults to true (compatible with previous behaviour); thanks @pcfens - PuppetSyntax::Manifests#check now has two return arguments ## [v1.4.1](https://github.com/voxpupuli/puppet-syntax/tree/v1.4.1) (2015-01-08) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.4.0...v1.4.1) - Support appending to config arrays, thanks @domcleal ## [v1.4.0](https://github.com/voxpupuli/puppet-syntax/tree/v1.4.0) (2014-12-18) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.3.0...v1.4.0) - Rspec 3 is now supported, thanks @tuxmea - Build error fixed where gem_publisher was used prematurely - Lazy load Puppet only when it's required, thanks @logicminds ## [v1.3.0](https://github.com/voxpupuli/puppet-syntax/tree/v1.3.0) (2014-08-07) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.2.3...v1.3.0) - Add the ability to pass hieradata_paths array of globs to check - Check hieradata in modules ('**/data/**/*.yaml') by default ## [v1.2.3](https://github.com/voxpupuli/puppet-syntax/tree/v1.2.3) (2014-08-06) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.2.2...v1.2.3) - Fix puppetlabs_spec_helper warning on Ruby 1.8 ## [v1.2.2](https://github.com/voxpupuli/puppet-syntax/tree/v1.2.2) (2014-07-31) [Full Changelog](https://github.com/voxpupuli/puppet-syntax/compare/v1.2.0...v1.2.2) - Check and document conflicts with puppetlabs_spec_helper <= 0.7.0 ## v1.2.1 (2014-07-23) - Remove dependency on Puppet from Gemspec (for Puppet Entreprise users). ## v1.2.0 (2014-03-28) - Optional support for Puppet's future parser. ## v1.1.1 (2014-03-17) - Ignore exit(1) from Puppet 3.4 - Don't use hardcoded version of parser face. ## v1.1.0 (2013-09-06) - Syntax checks for Hiera YAML files. - Improved documentation. ## v1.0.0 (2013-07-04) - Refactor code to make it easier to test. - Implement spec tests for syntax checks. - Pending spec tests for FileList matching. - Matrix tests for other Ruby/Puppet versions. - Improve usage example in README. ## v0.0.4 (2013-06-14) - Fix `$confdir` error for Puppet 3.x ## v0.0.3 (2013-06-11) - List rake as a dependency. - Output names of tasks to STDERR. - Match template paths correctly. - Add pending spec tests, not yet working. ## v0.0.2 (2013-06-10) - Fix namespacing of rake tasks. ## v0.0.1 (2013-06-10) - Initial release \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*