diff --git a/lib/puppet-lint/bin.rb b/lib/puppet-lint/bin.rb index 7990061d..593d06ae 100644 --- a/lib/puppet-lint/bin.rb +++ b/lib/puppet-lint/bin.rb @@ -66,13 +66,13 @@ def run path = path.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR path = if File.directory?(path) - Dir.glob([ - "#{path}/**/*.pp", - "#{path}/**/*.{yaml,yml}" - ]) - else - @args - end + Dir.glob([ + "#{path}/**/*.pp", + "#{path}/**/*.{yaml,yml}", + ]) + else + @args + end PuppetLint.configuration.with_filename = true if path.length > 1 diff --git a/lib/puppet-lint/checks.rb b/lib/puppet-lint/checks.rb index 4b814d95..77b66e8e 100644 --- a/lib/puppet-lint/checks.rb +++ b/lib/puppet-lint/checks.rb @@ -57,7 +57,7 @@ def run(fileinfo, data) load_data(fileinfo, data) checks_run = [] - if File.extname(fileinfo).downcase.match?(/\.ya?ml$/) + if File.extname(fileinfo).downcase.match?(%r{\.ya?ml$}) enabled_checks.select { |check| YAML_COMPATIBLE_CHECKS.include?(check) }.each do |check| klass = PuppetLint.configuration.check_object[check].new # FIXME: shadowing #problems diff --git a/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb b/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb index 8912841c..e312a0d5 100644 --- a/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb +++ b/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb @@ -114,13 +114,13 @@ PuppetLint.new_check(:legacy_facts) do def check - if File.extname(PuppetLint::Data.path).downcase.match?(/\.ya?ml$/) + if File.extname(PuppetLint::Data.path).downcase.match?(%r{\.ya?ml$}) begin content = PuppetLint::Data.manifest_lines yaml_content = content.join("\n") data = YAML.safe_load(yaml_content, aliases: true, permitted_classes: [Symbol]) search_yaml(data) - rescue => e + rescue StandardError => e raise e end else @@ -142,8 +142,8 @@ def search_yaml(data, path = []) end end - def search_value(value, path) - value.scan(/%{(?:(?:::?)?|facts\.)([a-zA-Z0-9_]+)(?!\.[a-zA-Z])}/) do |match| + def search_value(value, _path) + value.scan(%r{%{(?:(?:::?)?|facts\.)([a-zA-Z0-9_]+)(?!\.[a-zA-Z])}}) do |match| base_fact = match[0].split('.').first next unless EASY_FACTS.include?(base_fact) || UNCONVERTIBLE_FACTS.include?(base_fact) || base_fact.match(Regexp.union(REGEX_FACTS))