Skip to content

puppet-lint has encountered an error that it doesn't know how to handle #251

@nvuillam

Description

@nvuillam

Describe the Bug

❌ Linted [PUPPET] files with [puppet-lint]: Found 1 error(s) and 0 warning(s) - (0.19s)

  • Using [puppet-lint v4.3.0] https://megalinter.io/pr-6133/descriptors/puppet_puppet_lint
  • MegaLinter key: [PUPPET_PUPPET_LINT]
  • Rules config: identified by [puppet-lint]
  • Command: [puppet-lint --fail-on-warnings --no-autoloader_layout-check puppet_good_1.pp]
    [puppet-lint] puppet_good_1.pp - ERROR - 1 error(s) and 0 warning(s)
    --Error detail:
    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.3.0
ruby version: 3.4.4-p34
platform: x86_64-linux-musl
file path: puppet_good_1.pp
file contents:

# This is a class documentation :)
class foo {

  $bar = 'bar'

  $gronk = 'gronk'

  $this_line = "I mean, a really, really long line like you can't believe"
}

error:

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

Expected Behavior

No crash :)

Steps to Reproduce

Steps to reproduce the behavior:

See issue in MegaLinter related build Github action -> https://github.com/oxsecurity/megalinter/actions/runs/17698468874/job/50300923798?pr=6133

Environment

  • Version 4.3.0
  • Platform: Docker image python:3.13-alpine3.22

Additional Context

This issue happens while we are trying to upgrade MegaLinter base image from python:3.13-alpine3.21 to python:3.13-alpine3.22

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions