Skip to content

Fix NoMethodError in puppet_strings_helper.rb #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

scoiatael
Copy link
Contributor

FYI when ran against our codebase LSP fails with error

A, [2022-01-18T12:35:46.485073 #31693]   ANY -- : SidecarQueue Thread: Calling sidecar with --action workspace_aggregate --local-workspace ~/.git/puppet --puppet-version=6.21.1 returned exitcode 1, ~/.git/puppet-editor-services/lib/puppet-languages
erver-sidecar/puppet_strings_helper.rb:147:in `block (3 levels) in populate_classes_from_yard_registry!': undefined method `join' for nil:NilClass (NoMethodError)
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:143:in `each'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:143:in `block (2 levels) in populate_classes_from_yard_registry!'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:128:in `each'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:128:in `block in populate_classes_from_yard_registry!'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:127:in `each'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:127:in `populate_classes_from_yard_registry!'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:102:in `populate_from_yard_registry!'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:74:in `file_documentation'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:10:in `file_documentation'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_helper.rb:93:in `block in retrieve_via_puppet_strings'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_helper.rb:92:in `each'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_helper.rb:92:in `retrieve_via_puppet_strings'
        from ~/.git/puppet-editor-services/lib/puppet_languageserver_sidecar.rb:303:in `execute'
        from ~/.git/puppet-editor-services/lib/puppet_languageserver_sidecar.rb:360:in `execute_and_output'
        from ~/.git/puppet-editor-services/puppet-languageserver-sidecar:14:in `<main>'

This change fixes this issue.

Let me know how or if I should add specs for this edge-case.

FYI when ran against our codebase it fails with error

```
A, [2022-01-18T12:35:46.485073 #31693]   ANY -- : SidecarQueue Thread: Calling sidecar with --action workspace_aggregate --local-workspace ~/.git/puppet --puppet-version=6.21.1 returned exitcode 1, ~/.git/puppet-editor-services/lib/puppet-languages
erver-sidecar/puppet_strings_helper.rb:147:in `block (3 levels) in populate_classes_from_yard_registry!': undefined method `join' for nil:NilClass (NoMethodError)
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:143:in `each'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:143:in `block (2 levels) in populate_classes_from_yard_registry!'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:128:in `each'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:128:in `block in populate_classes_from_yard_registry!'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:127:in `each'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:127:in `populate_classes_from_yard_registry!'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:102:in `populate_from_yard_registry!'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:74:in `file_documentation'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_strings_helper.rb:10:in `file_documentation'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_helper.rb:93:in `block in retrieve_via_puppet_strings'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_helper.rb:92:in `each'
        from ~/.git/puppet-editor-services/lib/puppet-languageserver-sidecar/puppet_helper.rb:92:in `retrieve_via_puppet_strings'
        from ~/.git/puppet-editor-services/lib/puppet_languageserver_sidecar.rb:303:in `execute'
        from ~/.git/puppet-editor-services/lib/puppet_languageserver_sidecar.rb:360:in `execute_and_output'
        from ~/.git/puppet-editor-services/puppet-languageserver-sidecar:14:in `<main>'
```
@CLAassistant
Copy link

CLAassistant commented Jan 18, 2022

CLA assistant check
All committers have signed the CLA.

@michaeltlombardi michaeltlombardi marked this pull request as ready for review January 24, 2022 14:15
@michaeltlombardi michaeltlombardi requested review from glennsarti and a team as code owners January 24, 2022 14:15
Copy link
Contributor

@michaeltlombardi michaeltlombardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The safe navigation operator has been in ruby since 2.3 which is older than we need to support, so I think we can just merge this as-is.

@michaeltlombardi michaeltlombardi merged commit 7f38790 into puppetlabs:main Jan 24, 2022
@jordanbreen28 jordanbreen28 added the bug Something isn't working label Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants