Open dosmanak opened 10 months ago
Thanks for your feedback. I don't have any time to work on yamlfixer for now, unfortunately.
Hi, I think there is just some leftover after refactor.
In filenames
argument, there is default=["-"]
already so I do not see reason for another adding in
https://github.com/opt-nc/yamlfixer/blob/0ce16e032d7348e996d00abb0ad79b9df610f5ef/yamlfixer/__main__.py#L49
When I removed lines 49-53, it seems working as expected to me:
$ echo -e "foo\nbar\nfoobar"| while read line; do yamlfixer -d $line; done
DEBUG: yamlfixer v0.9.15
DEBUG: arguments=Namespace(backup=False, backupsuffix='.orig', debug=True, diffto='/dev/null', ext='yaml,yml,yamllint', forcecolors=False, followsymlinks=False, listfixers=False, nosyntax=False, nochange=False, recurse=0, jsonsummary=False, plainsummary=False, summary=False, tabsize=2, config_file=None, config_data=None, filenames=['foo'])
DEBUG: yamlfixer v0.9.15
DEBUG: arguments=Namespace(backup=False, backupsuffix='.orig', debug=True, diffto='/dev/null', ext='yaml,yml,yamllint', forcecolors=False, followsymlinks=False, listfixers=False, nosyntax=False, nochange=False, recurse=0, jsonsummary=False, plainsummary=False, summary=False, tabsize=2, config_file=None, config_data=None, filenames=['bar'])
DEBUG: yamlfixer v0.9.15
DEBUG: arguments=Namespace(backup=False, backupsuffix='.orig', debug=True, diffto='/dev/null', ext='yaml,yml,yamllint', forcecolors=False, followsymlinks=False, listfixers=False, nosyntax=False, nochange=False, recurse=0, jsonsummary=False, plainsummary=False, summary=False, tabsize=2, config_file=None, config_data=None, filenames=['foobar'])
vs.
$ echo -e "foo\nbar\nfoobar"| yamlfixer -d
DEBUG: yamlfixer v0.9.15
DEBUG: arguments=Namespace(backup=False, backupsuffix='.orig', debug=True, diffto='/dev/null', ext='yaml,yml,yamllint', forcecolors=False, followsymlinks=False, listfixers=False, nosyntax=False, nochange=False, recurse=0, jsonsummary=False, plainsummary=False, summary=False, tabsize=2, config_file=None, config_data=None, filenames=['-'])
DEBUG: Fixing <stdin> ...
DEBUG: Executing linter with 'yamllint --format parsable --strict -'
DEBUG: Linter's exit code is 2
DEBUG: (1+0, 1+0) => [missing document start "---" (document-start)]
DEBUG: Calling fix_missing_docstart("", "foo")
DEBUG: HANDLED: #1
---
foo
bar
foobar
DEBUG: Executing linter with 'yamllint --format parsable --strict -'
DEBUG: Linter's exit code is 0
DEBUG: was fixed
So I created PR https://github.com/opt-nc/yamlfixer/pull/219 I am not sure if there is anything special with Github actions, so if you could verify, that would by great!
1️⃣ Description
Using in bash
while read line; do yamlfixer $line; done
is not working as expected.📑 Steps to Reproduce
2️⃣ Expected behavior
The debug message shows
filenames=['foo', '-'])
and the rest of lines are read. I'd expect, if there is single parameter 'foo', the command will not read from stdin. Some check of existing file will also help.Additional context
Thank you for great approach combining yamllint output!