Summary:
- Add and update linter rules related to logging
- Combine missing_linebreak_before_errmsg,
missing_linebreak_before_errdetail, missing_linebreak_before_errhint
to a single rule missing_linebreak_before_err
- Additionally handle errcode in this rule
- Avoid false positives with comments containing text such as
"errmsg()"
- Blacklist some files where upstream postgres breaks this rule
- Add new rule missing_linebreak_before_paren_err
- Make it a warning instead of error because upstream postgres
breaks this rule several times
- Add new rule missing_paren_before_err
- Update likely_bad_capitalization_in_errmsg,
likely_bad_lowercase_in_errdetail, likely_bad_lowercase_in_errhint
- Capture more cases where "err" is preceded by opening parenthesis
- Make likely_bad_lowercase_in_errhint handle errhint_plural as
well, just like how likely_bad_lowercase_in_errdetail does it
(this must have been missed previously)
- Fix the regex to properly find bad casing (this must have been an
oversight previously)
- Fix likely_bad_.*err.* rules manually, avoiding false positives, which
were found in the following files:
- verify_nbtree.c
- cube.c
- jsonb_plpython.c
- passwordcheck.c
- pgcrypto.c
- heap_surgery.c
- pqcomm.c
- postgres.c
- spell.c
- jsonbsubs.c
- varlena.c
- plperl.c
- ybgin.c
- pg_yb_utils.c
While at it, fix punctuation as well (errmsg should not have
sentence-ending punctuation; errdetail/errhint should), fix
grammar/spelling, and break long errmsg to errdetail/errhint where
suitable.
Jira: DB-14732
Test Plan:
On Almalinux 8, zsh with EXTENDEDGLOB option:
[ -z "$(arc lint src/postgres/**/*.{c,h} | grep missing_linebreak_before_err)" ]
Close: #25482
Jenkins: all tests
Reviewers: rbarigidad, vpatibandla, devansh.saxena
Reviewed By: devansh.saxena
Subscribers: ybase, yql, ycdcxcluster
Differential Revision: https://phorge.dev.yugabyte.com/D40958