Skip to content

reads file from stdin even if argument with file provided #218

@dosmanak

Description

@dosmanak

1️⃣ Description

Using in bash while read line; do yamlfixer $line; done is not working as expected.

📑 Steps to Reproduce

$ 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: 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("", "bar")
DEBUG: HANDLED: #1
---
bar
foobar
DEBUG: Executing linter with 'yamllint --format parsable --strict -'
DEBUG: Linter's exit code is 0
DEBUG: was fixed

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions