Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amend error messages and prompts of various (sub)commands #635

Open
periperidip opened this issue May 18, 2020 · 4 comments
Open

Amend error messages and prompts of various (sub)commands #635

periperidip opened this issue May 18, 2020 · 4 comments
Labels
good first issue Good for newcomers

Comments

@periperidip
Copy link

The Git suite CodingGuidelines suggest this about Error messages:

Error Messages

  • Do not end error messages with a full stop.

  • Do not capitalize ("unable to open %s", not "Unable to open %s")

  • Say what the error is first ("cannot open %s", not "%s: cannot open")

There are various instances of violation of these rules, for instance here and here. These violations need to be amended.

@Denton-L Denton-L added the good first issue Good for newcomers label May 19, 2020
@adlternative
Copy link

Excuse me, should I correct every error manually? These error messages not only appeared in thousands

Can you give me more specific information, which files should I or should not modify, including all'.c' files or'.h' files? Do I need to modify the error messages in other types of files?
This error message is probably those errors that contain BUG('Un...') or die('Un..') or error, warning as the premise, then if die("I am...") or die("BUG") Should I modify the first letter of these characters that should be capitalized?

Today I tried to write a python script using regular expressions to solve this issue, it is possible to produce wrong modifications...
For example, the ... at the end of the line will be mistaken for the last point of the . deleted

@periperidip
Copy link
Author

Excuse me, should I correct every error manually? These error messages not only appeared in thousands

One approach can be to first sieve out strings starting with die("<Capital Letter>...) using Regex. From there, doing it all manually or use a script, depends on you.

Can you give me more specific information, which files should I or should not modify, including all'.c' files or'.h' files? Do I need to modify the error messages in other types of files?

Most of them are in .c with a couple of those in .h, namely:

  1. die("Cannot handle files this big"); in git-compat-util.h.
  2. die("Error submodule '%s' not populated.", path); in refs.h. This one is a comment so you may leave it.

Rest are in .c files.

This error message is probably those errors that contain BUG('Un...') or die('Un..') or error, warning as the premise, then if die("I am...") or die("BUG") Should I modify the first letter of these characters that should be capitalized?

No, you do not have to de-capitalise keywords like BUG. Only the usual English words. There is a small caveat to this: some error messages are translated into languages therefore you need to make sure the change is consistent with the translation as well. You may find the translations in *.po files.

Today I tried to write a python script using regular expressions to solve this issue, it is possible to produce wrong modifications...
For example, the ... at the end of the line will be mistaken for the last point of the . deleted

I understand. I would say that trying this manually will help a lot.

@fobiasic07
Copy link

Hello, I've been looking through this issue to submit as part of my outreachy contribution and I'm faced with a challenge:

Where can I find the die(_( )) function defined? Is it in one particular library or multiple? I believe this can help me obtain a better defined regex expression in order to write a script that can match the error messages with the CodingGuidelines.

@dscho
Copy link
Member

dscho commented Oct 21, 2022

Where can I find the die(_( )) function defined?

@fobiasic07 It is defined here, handing off to die_routine, which is a function pointer that usually points to die_builtin().

Yep, a looooot of redirection going on here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants