Skip to content

Empty lines between files are contatenated at the end of output if output is redirected to file #234

@fenuks

Description

@fenuks

I'm using pydoclint version 0.6.5, and noticed weird behaviour when stderr is
redirected to stdout and then to file. It can be seen when executing snippet
below:

pydoclint --version
cat << EOF >| /tmp/test.py
def fun1(a: str):
    """
    Test

    :param b: Wrong argname.
    """
EOF

cat << EOF >| /tmp/test2.py
def fun2(a: str):
    """
    Test

    :param b: Wrong argname.
    """
EOF

cat << EOF >| /tmp/test3.py
def fun3(a: str):
    """
    Test

    :param b: Wrong argname.
    """
EOF

rm -f /tmp/out
pydoclint --style sphinx /tmp/test*.py &> /tmp/out
cat /tmp/out

When executed without redirection to file output will be something like this:

$ pydoclint --style sphinx /tmp/test*.py
Skipping files that match this pattern: \.git|\.tox
/tmp/test2.py
/tmp/test3.py
/tmp/test.py
/tmp/test2.py
    some errors

/tmp/test3.py
    some errors

/tmp/test.py
    some errors

but with redirection newlines between files are happening at the end of the output:

Skipping files that match this pattern: \.git|\.tox
/tmp/test2.py
/tmp/test3.py
/tmp/test.py
/tmp/test2.py
    some errors
/tmp/test3.py
    some errors
/tmp/test.py
    some errors


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions