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

Read manifest from stdin and write modifications to stdout #214

Open
bezier-h opened this issue Jul 19, 2024 · 1 comment
Open

Read manifest from stdin and write modifications to stdout #214

bezier-h opened this issue Jul 19, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@bezier-h
Copy link

Use Case

Git can be configured to automatically run filters on files when e.g. running git add thanks to filters. See the relevant documentation.

However this requires the linter to be able to read the file to process on its stdin and write its modifications to stdout. Git will indeed only use the stdout of the filter to determine what to add to the index, which with puppet-lint means it thinks the whole file has been deleted since it did not write anything to stdout.

Describe the Solution You Would Like

Changing the default behaviour of the tool would most probably incur breakage so it is not recommended.

There are two solutions I can think of:

  • if a file name consists of a single dash (-), puppet-lint reads standard input and write modifications to this file to standard output
  • a switch --stdin could be added so that puppet-lint does not process any files on disk and instead only read its stdin and writes to stdout. It would also error out if any paths were given on the command line, so as to prevent misuses.

Describe Alternatives You've Considered

Implementing the linter as a long running filter process as per the documentation, but that would require significant work, whereas the proposed solution is rather straightforward.

@bezier-h bezier-h added the enhancement New feature or request label Jul 19, 2024
@ekohl
Copy link

ekohl commented Jul 19, 2024

I'd prefer a dash for the input filename since that's a common convention. Then it should error out if it receives multiple files

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

2 participants