Re: [PATCH] devel: two scripts for checking proposed changes

Subject: Re: [PATCH] devel: two scripts for checking proposed changes

Date: Tue, 29 Jun 2021 08:27:43 -0300

To: Tomi Ollila, notmuch@notmuchmail.org

Cc:

From: David Bremner


Tomi Ollila <tomi.ollila@iki.fi> writes:

>> +
>> +set -e
>> +make test
>
> This may fail miserably (or is painfully slow (doing configure and make...)
>

At least for my use case, running the tests for each commit is the main
point. The formatting stuff is nice to have, but only if the tests run.
I could invoke the notmuch-test script directly, but that is
arguably slightly less robust because of the need to create test-binaries.

>> +for file in $(git diff --name-only HEAD^); do
>
> is this also mentioning deleted files... ? (--diff-filter=AM) ?

Oh, good point.

>
>> +    case $file in
>> +	*.c|*.h|*.cc|*.hh)
>> +            uncrustify --replace -c $(dirname "$0")/uncrustify.cfg "$file"
>
> dirname "$0" could be resolved once before loop.
>

yes, although I'm not sure it's a win?

>> +	    ;;
>> +	*.el)
>> +            $(dirname "$0")/reindent-elisp "$file"
>> +	    ;;
>> +    esac
>> +done
>> +
>> +git diff --quiet
>> +
>> diff --git a/devel/reindent-elisp b/devel/reindent-elisp
>> new file mode 100755
>> index 00000000..f6ce3844
>> --- /dev/null
>> +++ b/devel/reindent-elisp
>> @@ -0,0 +1,8 @@
>> +#!/bin/sh
>> +
>> +if [ $# -lt 1 ]; then
>
> if [ $# -ne 1 ] ... (see at the end)
>
OK
>> +    printf "usage: $0 <path.el>\n"
>
> Angle brackets are bad in example -- if copy-pasted to terminal (and badly
> edited) does redirections...

ack

>
>> +    exit 1
>> +fi
>> +
>> +emacs -Q --batch $1 --eval '(indent-region (point-min) (point-max) nil)'
>> -f save-buffer
>
> ... as here is $1 -- which should be quoted as "$1"

OK

>
>> -- 
>> 2.30.2
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: