Skip to content

Read manifest from stdin and write modifications to stdout #214

Open
@bezier-h

Description

@bezier-h

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions