From: "René Scharfe" <l.s.r@web.de>
To: Andrei Rybak <rybak.a.v@gmail.com>, Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] t5000: use check_mtime()
Date: Mon, 27 Mar 2023 19:59:56 +0200 [thread overview]
Message-ID: <a47f8172-a8d0-abe8-09a8-f31b9e19b1a1@web.de> (raw)
In-Reply-To: <5e53c8be-92b7-82e0-e204-a0cbfdffc529@gmail.com>
Am 26.03.23 um 14:53 schrieb Andrei Rybak:
>
> The only tangentially related nitpick is to the function check_mtime(),
> which doesn't follow the code style for Shell scripts -- a space is missing
> before parentheses. Same for almost all the other helper functions in test
> files related to git-archive:
>
> $ git grep -E '^[a-z_]+[(][)]' t/t500*
> t/t5000-tar-tree.sh:get_pax_header() {
> t/t5000-tar-tree.sh:check_tar() {
> t/t5000-tar-tree.sh:check_added() {
> t/t5000-tar-tree.sh:check_mtime() {
> t/t5001-archive-attr.sh:test_expect_exists() {
> t/t5001-archive-attr.sh:test_expect_missing() {
> t/t5002-archive-attr-pattern.sh:test_expect_exists() {
> t/t5002-archive-attr-pattern.sh:test_expect_missing() {
> t/t5003-archive-zip.sh:check_zip() {
> t/t5003-archive-zip.sh:check_added() {
> t/t5004-archive-corner-cases.sh:make_dir() {
> t/t5004-archive-corner-cases.sh:check_dir() {
> t/t5004-archive-corner-cases.sh:build_tree() {
>
> compare to:
>
> $ git grep -E '^[a-z_]+ [(][)]' t/t500*
> t/t5000-tar-tree.sh:tar_info () {
> t/t5001-archive-attr.sh:extract_tar_to_dir () {
>
>
> Quote from Documentation/CodingGuidelines:
>
> - We prefer a space between the function name and the parentheses,
> and no space inside the parentheses. The opening "{" should also
> be on the same line.
> (incorrect)
> my_function(){
> ...
> (correct)
> my_function () {
> ...
>
Care to send a patch?
There's more by the way:
$ git grep -c '^[a-zA-Z0-9_]*()' t/*.sh | awk -v FS=: '{c[substr($1,1,4)]+=$2} END {for (x in c) print x "*.sh:" c[x]}'
t/t0*.sh:16
t/t1*.sh:35
t/t2*.sh:3
t/te*.sh:2
t/t3*.sh:22
t/t4*.sh:23
t/t5*.sh:68
t/t6*.sh:11
t/t7*.sh:40
t/t8*.sh:1
t/t9*.sh:31
t/li*.sh:26
Personally I'd like to avoid wasting space and the second form looks odd
to me, which turned me into a repeat offender out of negligence, I
guess. Anyway, since we have a documented rule (that came about by
majority vote of code lines IIUC) we should follow it.
René
next prev parent reply other threads:[~2023-03-27 18:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-25 12:16 [PATCH] t5000: use check_mtime() René Scharfe
2023-03-26 12:53 ` Andrei Rybak
2023-03-27 17:59 ` René Scharfe [this message]
2023-03-27 22:45 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a47f8172-a8d0-abe8-09a8-f31b9e19b1a1@web.de \
--to=l.s.r@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rybak.a.v@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).