From: Jonathan Nieder <jrnieder@gmail.com>
To: Alangi Derick <alangiderick@gmail.com>
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>
Subject: Re: Improving code base readability
Date: Fri, 1 May 2015 11:59:46 -0700 [thread overview]
Message-ID: <20150501185946.GV5467@google.com> (raw)
In-Reply-To: <CAKB+oNvB322hyX3UbGBPETDc0zEdC39PdeM=GG=rVf_WYGq_OA@mail.gmail.com>
Hi,
Alangi Derick wrote:
> This is an example of what i am talking about or what i am trying to
> demonstrate. This is the patch:
Thanks for giving an example.
[...]
> --- a/archive-tar.c
> +++ b/archive-tar.c
> @@ -102,7 +102,7 @@ static int stream_blocked(const unsigned char *sha1)
>
> st = open_istream(sha1, &type, &sz, NULL);
> if (!st)
> - return error("cannot stream blob %s", sha1_to_hex(sha1));
> + return error("Cannot stream blob %s", sha1_to_hex(sha1));
This is not about code readability but about the program's output, no?
Habit is to use lowercase for error messages, to be brief, and to not
include a period at the end since they are not sentences. For
example:
$ nonexistent-command
bash: nonexistent-command: command not found
Git tends to follow that practice, too, though it is not completely
consistent about it.
As a first contribution, I don't think this is a good project to
embark on. It would touch a lot of code, meaning it is difficult to
time to avoid interfering with other patches. It is relatively
low-impact or the impact is hard to demonstrate: consistency is
pleasant, but the capitalization does not seem to be interfering with
the program's usability. Once the work is done, it is easy to
backslide unless there is an automated test to avoid that, which makes
the work more technically complicated.
If you'd like a project that involves touching a large part of the
codebase, one ongoing project has been to mark human-readable strings
for translation. See "Marking strings for translation" in po/README
for hints about how that works.
The same timing issues about avoiding conflicting with other people's
work apply there, too, but I'd be happy to help as you go. And the
impact can be pretty big, both in consistency (a mixture of English
and native language output due to incomplete i18n is not a great
experience) and usability (for some, being able to interact with git
in their native language makes using git much easier).
A search with
git grep --cached -F -e 'error("'
finds many files with untranslated strings.
Such work might lead you to discover unclear code, unclear messages,
or aspects of git's behavior that you'd like to change, which can also
lead to other patches that go in other directions.
What do you think?
Thanks,
Jonathan
next prev parent reply other threads:[~2015-05-01 18:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 15:26 Improving code base readability Alangi Derick
2015-05-01 18:59 ` Jonathan Nieder [this message]
2015-05-02 7:00 ` Alangi Derick
2015-05-02 7:15 ` Alangi Derick
2015-05-03 16:11 ` Kevin Daudt
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150501185946.GV5467@google.com \
--to=jrnieder@gmail.com \
--cc=alangiderick@gmail.com \
--cc=git@vger.kernel.org \
--cc=sbeller@google.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.
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 NNTP newsgroup(s).