Skip to content
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

Implement puppet-lint-plugin helper metods #33

Open
bastelfreak opened this issue Dec 16, 2021 · 3 comments
Open

Implement puppet-lint-plugin helper metods #33

bastelfreak opened this issue Dec 16, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@bastelfreak
Copy link
Collaborator

Use Case

Hi!
multiple puppet-lint plugins carry the same methods to extract some data: https://github.com/voxpupuli/puppet-lint-optional_default-check/blob/master/lib/puppet-lint/plugins/check_optional_default.rb#L46-L140

they are currently copied over to new gems if they require those functions. I think they are really helpful and would be a good fit for puppet-lint itself. I do not have proper Ruby/puppet-lint knowledge to implement them myself here, so I'm raising this ticket.

Describe the Solution You Would Like

Implement the methods from the linked puppet-lint plugin in puppet-lint core.

Describe Alternatives You've Considered

copy them to new gems if required

Additional Context

nothing

@bastelfreak bastelfreak added the enhancement New feature or request label Dec 16, 2021
@ekohl
Copy link

ekohl commented Dec 16, 2021

You should link to a specific commit so the line numbers can't change anymore. On the blob page (in your current link) there's a keyboard shortcut y to change the URL to:
https://github.com/voxpupuli/puppet-lint-optional_default-check/blob/ea35a85e51571794c0038293147d4e68974461d4/lib/puppet-lint/plugins/check_optional_default.rb#L46-L140

@bastelfreak bastelfreak changed the title Implement puppet-ling-plugin helper metods Implement puppet-lint-plugin helper metods Dec 16, 2021
@ekohl
Copy link

ekohl commented Dec 16, 2021

As you can see, puppet-lint today only has a lexer. I'm not sure if you want to maintain a full parser in puppet-lint or if you can reuse something. Perhaps at that point you actually want the parser used in Puppet itself (which is racc) and operate on that. That would be much heavier though. Way more expensive and you'd tie to Puppet internals.

I think you actually want a parser and an abstract syntax tree (or concrete syntax tree). Then you can do more advanced checks. I also felt the desire for that.

@chelnak
Copy link

chelnak commented Oct 2, 2022

@ekohl @bastelfreak Is this still something that people would be interested in?

I'd be happy to take a look.. just probably need to understand it ask a bit more so we can make sure the DX is good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants