Skip to content

diffFilter outputs in incorrect format if there are no changes #72

Open
@tomalec

Description

@tomalec

When I call diffFilter on an empty change set, it logs a "No lines found!" error but returns a 0 success code.

For example:

diffFilter --phpcsStrict < (git diff HEAD...HEAD)  phpcs.json --report=phpcs 0

outputs an empty string, instead of a JSON object.

In my scripting, when a command returns success code, I assume it produced the output in expected format as it does for any successful input and run.
If the command encounters an error, making it unable to proceed to produce meaningful output, it should return error code, so I could catch that and act accordingly.

But, the line

error_log('No lines found!');
return;

logs an error, does not produce any output, and returns "successfully".
IMHO, it should either

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