Skip to content

Commit

Permalink
Fix rubocop warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Didrichsen <[email protected]>
  • Loading branch information
gavindidrichsen committed Jun 20, 2024
1 parent e14a510 commit 7bf8b43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions lib/puppet-lint/lexer/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ def find_token_of(direction, type, opts = {})
return nil unless [:next, :prev].include?(direction)

opts[:skip_blocks] ||= true
to_find = Array[*type]
to_find = [*type]

token_iter = send("#{direction}_token".to_sym)
token_iter = send(:"#{direction}_token")
until token_iter.nil?
return token_iter if to_find.include?(token_iter.type) && (opts[:value].nil? || token_iter.value == opts[:value])

Expand All @@ -183,18 +183,18 @@ def find_token_of(direction, type, opts = {})

if opts[:skip_blocks]
case token_iter.type
when "#{opening_token}BRACE".to_sym
token_iter = token_iter.send("#{direction}_token_of".to_sym, ["#{closing_token}BRACE".to_sym, opts])
when "#{opening_token}BRACK".to_sym
token_iter = token_iter.send("#{direction}_token_of".to_sym, ["#{closing_token}BRACK".to_sym, opts])
when "#{opening_token}PAREN".to_sym
token_iter = token_iter.send("#{direction}_token_of".to_sym, ["#{closing_token}PAREN".to_sym, opts])
when :"#{opening_token}BRACE"
token_iter = token_iter.send(:"#{direction}_token_of", [:"#{closing_token}BRACE", opts])
when :"#{opening_token}BRACK"
token_iter = token_iter.send(:"#{direction}_token_of", [:"#{closing_token}BRACK", opts])
when :"#{opening_token}PAREN"
token_iter = token_iter.send(:"#{direction}_token_of", [:"#{closing_token}PAREN", opts])
end
end

return nil if token_iter.nil?

token_iter = token_iter.send("#{direction}_token".to_sym)
token_iter = token_iter.send(:"#{direction}_token")
end
nil
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet-lint/tasks/puppet-lint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def define(args, &task_block)

['with_filename', 'fail_on_warnings', 'error_level', 'log_format', 'with_context', 'fix', 'show_ignored', 'relative'].each do |config|
value = instance_variable_get(:"@#{config}")
PuppetLint.configuration.send("#{config}=".to_sym, value) unless value.nil?
PuppetLint.configuration.send(:"#{config}=", value) unless value.nil?
end

@ignore_paths = PuppetLint.configuration.ignore_paths if PuppetLint.configuration.ignore_paths && @ignore_paths.empty?
Expand Down

0 comments on commit 7bf8b43

Please sign in to comment.