Skip to content

NoMethodError: undefined method '[]' for nil with ruby3.4.0dev #225

Open
@mtasaka

Description

@mtasaka

Using ruby 3.4.0dev (2024-12-04 master e539342f65) +PRISM [x86_64-linux]
ruby/ruby@e539342

pupplet-lint git head 167ab94
rspec testsuite does not do anything but exits abnormally:

$ rspec spec/unit ; echo $?
rspec/json_expectations is not available
WARNING: `around(:context)` hooks are not supported and behave like `around(:example)`. Called from /builddir/build/GIT/puppet-lint/spec/unit/puppet-lint/bin_spec.rb:608:in 'block (3 levels) in <top (required)>'.

PuppetLint::Bin
  when running normally
    exitstatus

Finished in 0.00475 seconds (files took 0.32275 seconds to load)
1 example, 0 failures

1

Then explicitly executing testsuite shows backtrace error:

$ env RUBYLIB=$(pwd)/lib ./bin/puppet-lint ./spec/fixtures/test/manifests/init.pp
Whoops! It looks like puppet-lint has encountered an error that it doesn't
know how to handle. Please open an issue at https://github.com/puppetlabs/puppet-lint
and paste the following output into the issue description.
---
puppet-lint version: 4.2.4
ruby version: 3.4.0-p-1
platform: x86_64-linux
file path: ./spec/fixtures/test/manifests/init.pp
file contents:
---
# foo
class test {
}

---
error:
---
NoMethodError: undefined method '[]' for nil
/builddir/build/GIT/puppet-lint/lib/puppet-lint/data.rb:63:in 'PuppetLint::Data.tokens'
/builddir/build/GIT/puppet-lint/lib/puppet-lint/data.rb:608:in 'PuppetLint::Data.parse_control_comments'
/builddir/build/GIT/puppet-lint/lib/puppet-lint/checks.rb:26:in 'PuppetLint::Checks#load_data'
/builddir/build/GIT/puppet-lint/lib/puppet-lint/checks.rb:55:in 'PuppetLint::Checks#run'
/builddir/build/GIT/puppet-lint/lib/puppet-lint.rb:226:in 'PuppetLint#run'
/builddir/build/GIT/puppet-lint/lib/puppet-lint/bin.rb:85:in 'block in PuppetLint::Bin#run'
/builddir/build/GIT/puppet-lint/lib/puppet-lint/bin.rb:80:in 'Array#each'
/builddir/build/GIT/puppet-lint/lib/puppet-lint/bin.rb:80:in 'PuppetLint::Bin#run'
./bin/puppet-lint:7:in '<main>'
---

Works normally with ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [x86_64-linux]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions