Skip to content

Commit

Permalink
ran rubocop -a
Browse files Browse the repository at this point in the history
  • Loading branch information
alex501212 committed Feb 18, 2025
1 parent e234ad6 commit e06438f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions lib/puppet-lint/bin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet-lint/checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check failure on line 123 in lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb

View workflow job for this annotation

GitHub Actions / spec (ruby 3.2) / spec

Lint/UselessRescue: Useless `rescue` detected.

Check failure on line 123 in lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb

View workflow job for this annotation

GitHub Actions / spec (ruby 2.7) / spec

Lint/UselessRescue: Useless `rescue` detected.

Check failure on line 123 in lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb

View workflow job for this annotation

GitHub Actions / spec (ruby 3.3) / spec

Lint/UselessRescue: Useless `rescue` detected.
raise e
end
else
Expand All @@ -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))

Expand Down

0 comments on commit e06438f

Please sign in to comment.