Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Option to output only the filenames with errors when checking? #166

Open
matatk opened this issue Aug 8, 2019 · 1 comment
Open

Option to output only the filenames with errors when checking? #166

matatk opened this issue Aug 8, 2019 · 1 comment

Comments

@matatk
Copy link

matatk commented Aug 8, 2019

When checking a directory tree for the first time, a large number of errors can be reported for each file. This causes the filenames themselves to be lost off-screen. I was thinking it might be helpful to have a command-line option to output only the filenames of files with errors.

Thank you for making eclint; it's a helpful tool :-).

@tajmone
Copy link

tajmone commented Nov 20, 2019

I totally agree with @matatk. Error logs can easily be hundreds of lines long for each file, for usually when a source file doesn't comply to a given indentation convention it does so on most lines.

I use files-only filtered EClint reports so often that I've added a custom alias to my shell for this:

alias ecbrief='eclint check 2>&1 | grep  "^[^ ]"'

Having someghing like a --brief option for eclint check, to limit error logs to listing files only, is especially needed for big projects that rely on EClint for continuous integration build tests, where one wishes to keep the failure log as brief as possible.

In my repositories I use a custom script to achieve this, by first redirecting EClint output to a temporary file and then, in case of failure, print a filtered version of it via grep "^[^ ]" — here's an example from my validate.sh script:

# ==============
# Validate Files
# ==============
# Check that project files meet the code style standards set in `.editorconfig`;
# if not, print only the list of files that failed -- because EClint reports are
# usually too long.

tmpLog=./eclint.log
eclint check 2> $tmpLog || {
    echo -e "\033[31;1m~~~ ERROR! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
    echo -e "\033[31;1mThe following files didn't pass the validation test:\n\033[33;1m";
    cat $tmpLog | grep  "^[^ ]";
    echo -e "\033[31;1m\n\033[31;1mRun ECLint locally for detailed information about the problems.";
    echo -e "\033[31;1m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
    echo -e "\033[31;1m/// Aborting All Tests ///\033[0m";
    rm $tmpLog;
    exit 1;
    }
rm $tmpLog;
echo -e "\033[32;1m/// Test Passed ///\033[0m"
exit

Indeed, having a command line option to just list the files that didn't pass the test would be much better as it would spare the need for such scripts and could achieve the same with a single command on the configuration file of services like Travis CI.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants