puppet-lint icon indicating copy to clipboard operation
puppet-lint copied to clipboard

NoMethodError: undefined method '[]' for nil

Open qdii opened this issue 8 months ago • 1 comments

I'm getting this error when executing puppet-lint from pre-commit:

NoMethodError: undefined method '[]' for nil
/home/qdii/.local/share/gem/ruby/3.4.0/gems/puppet-lint-4.3.0/lib/puppet-lint/data.rb:63:in 'PuppetLint::Data.tokens'
/home/qdii/.local/share/gem/ruby/3.4.0/gems/puppet-lint-4.3.0/lib/puppet-lint/data.rb:608:in 'PuppetLint::Data.parse_control_comments'
/home/qdii/.local/share/gem/ruby/3.4.0/gems/puppet-lint-4.3.0/lib/puppet-lint/checks.rb:28:in 'PuppetLint::Checks#load_data'
/home/qdii/.local/share/gem/ruby/3.4.0/gems/puppet-lint-4.3.0/lib/puppet-lint/checks.rb:57:in 'PuppetLint::Checks#run'
/home/qdii/.local/share/gem/ruby/3.4.0/gems/puppet-lint-4.3.0/lib/puppet-lint.rb:226:in 'PuppetLint#run'
/home/qdii/.local/share/gem/ruby/3.4.0/gems/puppet-lint-4.3.0/lib/puppet-lint/bin.rb:88:in 'block in PuppetLint::Bin#run'
/home/qdii/.local/share/gem/ruby/3.4.0/gems/puppet-lint-4.3.0/lib/puppet-lint/bin.rb:83:in 'Array#each'
/home/qdii/.local/share/gem/ruby/3.4.0/gems/puppet-lint-4.3.0/lib/puppet-lint/bin.rb:83:in 'PuppetLint::Bin#run'
/home/qdii/.local/share/gem/ruby/3.4.0/gems/puppet-lint-4.3.0/bin/puppet-lint:7:in '<top (required)>'
/home/qdii/.cache/pre-commit/repocoj85kpa/rbenv-system/gems/bin/puppet-lint:25:in 'Kernel#load'
/home/qdii/.cache/pre-commit/repocoj85kpa/rbenv-system/gems/bin/puppet-lint:25:in '<main>'

Any idea what it could be?

qdii avatar Jul 07 '25 22:07 qdii

Hi @qdii , Nowadays puppet-lint is maintained in the puppetlabs namespace: https://github.com/puppetlabs/puppet-lint

So bugs should be reported over there.

That being said, I could imagine that you ran into the same problem reported with https://github.com/puppetlabs/puppet-lint/issues/225. (The stack trace looks similar.)

usev6 avatar Jul 09 '25 05:07 usev6