Changeset - bf85e6018daa
[Not reviewed]
default
0 2 0
Thomas De Schampheleire - 6 years ago 2020-03-07 20:48:02
thomas.de_schampheleire@nokia.com
scripts: properly check for errors in whitespacecleanup/run-all-cleanup

An error in whitespacecleanup, like a bug in isort that raises an exception,
should be treated as a problem instead of silently ignored.
2 files changed with 11 insertions and 7 deletions:
0 comments (0 inline, 0 general)
scripts/validate-commits
Show inline comments
 
@@ -31,32 +31,36 @@ trap finish EXIT
 

	
 
for rev in $(hg log -r "$1" -T '{node}\n'); do
 
    hg log -r "$rev"
 
    hg update "$rev"
 

	
 
    cleanup
 
    python3 -m venv "$venv"
 
    source "$venv/bin/activate"
 
    pip install --upgrade pip setuptools
 
    pip install -e . -r dev_requirements.txt python-ldap python-pam
 

	
 
    # run-all-cleanup
 
    scripts/run-all-cleanup
 
    if ! hg update --check -q .; then
 
        echo "run-all-cleanup did not give clean results!"
 
    if ! scripts/run-all-cleanup ; then
 
        echo "run-all-cleanup encountered errors!"
 
        result="NOK"
 
        hg diff
 
        hg revert -a
 
    else
 
        result=" OK"
 
        if ! hg update --check -q .; then
 
            echo "run-all-cleanup did not give clean results!"
 
            result="NOK"
 
            hg diff
 
            hg revert -a
 
        else
 
            result=" OK"
 
        fi
 
    fi
 
    echo "$result: $rev (run-all-cleanup)" >> "$resultfile"
 

	
 
    # pytest
 
    if py.test; then
 
        result=" OK"
 
    else
 
        result="NOK"
 
    fi
 
    echo "$result: $rev (pytest)" >> "$resultfile"
 

	
 
    deactivate
scripts/whitespacecleanup.sh
Show inline comments
 
#!/bin/bash -x
 
#!/bin/bash -xe
 

	
 
# Enforce some consistency in whitespace - just to avoid spurious whitespaces changes
 

	
 
files=`hg mani | egrep -v '/fontello/|/email_templates/|(^LICENSE-MERGELY.html|^docs/Makefile|^scripts/whitespacecleanup.sh|/(graph|mergely|native.history)\.js|/test_dump_html_mails.ref.html|\.png|\.gif|\.ico|\.pot|\.po|\.mo|\.tar\.gz|\.diff)$'`
 

	
 
sed -i "s/`printf '\r'`//g" $files
 
sed -i -e "s,`printf '\t'`,    ,g" $files
 
sed -i -e "s,  *$,,g" $files
 
sed -i -e 's,\([^ ]\)\\$,\1 \\,g' -e 's,\(["'"'"']["'"'"']["'"'"']\) \\$,\1\\,g' $files
 
# ensure one trailing newline - remove empty last line and make last line include trailing newline:
 
sed -i -e '$,${/^$/d}' -e '$a\' $files
 

	
0 comments (0 inline, 0 general)