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

feat: introduce --read-paths to threat PATH as a file containing manifest paths #241

Closed
wants to merge 4 commits into from

Conversation

Tyrael
Copy link

@Tyrael Tyrael commented Mar 15, 2025

Summary

Introducing --read-paths as a new boolean config option, defaulting to false.
When set to true, we would consider PATH as a file containing puppet manifests to lint, separated by newlines.
This is my first contribution here, so I dont't expect this to be accepted as-is, just let me know what should I improve/change to get this right.

Additional Context

We are using puppet-lint as part of our cicd pipelines, and we currently have to resort to xargsing each modified puppet manifest in and executing puppet-lint for each file.
With this change we would be able to specify a list of files to lint in a single puppet-lint execution

Checklist

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified.

@Tyrael Tyrael requested review from bastelfreak and a team as code owners March 15, 2025 09:45
@CLAassistant
Copy link

CLAassistant commented Mar 15, 2025

CLA assistant check
All committers have signed the CLA.

@bastelfreak
Copy link
Collaborator

Hi, stupid question:

we currently have to resort to xargsing each modified puppet manifest in and executing puppet-lint for each file.

Why? puppet-lint accepts directories, globbing and multiple file paths already.

Besides that my recommendation is to always lint all files. Otherwise you won't find issues that are marked by new linting rules, e.g. #175

@Tyrael
Copy link
Author

Tyrael commented Mar 15, 2025

Why? puppet-lint accepts directories, globbing and multiple file paths already.

we have a monorepo with a huge amount of modules and files, linting all of the repo for each MR would be a huge waste of resources and would slow down the lint pipeline a ton.

I've seen the support for passing a directory and globbing, but I couldn't find a way to pass an arbitrary list of files to puppet-lint, let me know if I missed something.

Besides that my recommendation is to always lint all files. Otherwise you won't find issues that are marked by new linting rules, e.g. #175

ofc. when changing puppet-lint version or .puppet-lint.rc we should and do rerun the linter on all files.

@Tyrael
Copy link
Author

Tyrael commented Mar 21, 2025

@bastelfreak could you please approve the workflow execution?

@bastelfreak
Copy link
Collaborator

but I couldn't find a way to pass an arbitrary list of files to puppet-lint

you can pass them on the cli like puppet-lint --fix manifests/foo.pp manifests/bar.pp

@Tyrael Tyrael closed this Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants