You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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:
puppet-lint
reads standard input and write modifications to this file to standard output--stdin
could be added so thatpuppet-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.
The text was updated successfully, but these errors were encountered: