puppetlabs / puppetlabs/puppet-editor-services

puppet-languageserver is incompatible with puppet-lint 4.3.0

Open Beginner friendly
#396 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ruby
Stars
52
Forks
21
Avg merge
15h
Merged PRs (30d)
3

Description

Describe the Bug

When replacing puppet-lint 4.2.4 with 4.3.0 in the vendor directory, puppet-languageserver stops producing diagnostics for lint errors

Expected Behavior

diagnostics should still get issued

Steps to Reproduce

Steps to reproduce the behavior:

  1. In the Rakefile, change the vendor ref to 4.3.0 and then build a release
  2. Start the languageserver per usual

Environment

  • Version 2.0.4
  • Platform Debian unstable (before trixie release)

Additional Context

I've identified a hack in the code for making the diagnostics still come out with puppet-lint 4.3.0. I have no idea if the solution is "the correct one" though.

The cause of the problem seems to be in https://github.com/puppetlabs/puppet-lint/commit/c35705b11334db8585ebde3757a915c4912fd543 where fileinfo started being passed as-is to File.extname(). puppet-languageserver give nil as a value to fileinfo so that call crashes.

the hack I used is to modify puppet-languageserver/manifest/validation_provider.rb at line 42 like the following (e.g. pass in an empty string to linter.run() instead of nil):

 39           linter = PuppetLint::Checks.new
 40           linter.load_data(nil, content)
 41 
 42           problems = linter.run('', content)
 43           unless problems.nil?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in manifest/validation_provider.rb around line 42 and review how puppet-lint receives fileinfo, then reproduce with the Rakefile vendor ref set to 4.3.0 and build a release. Run the language server as usual and confirm that diagnostics for lint errors are still produced with puppet-lint 4.3.0.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.