Summary:
- Add bad_spacing_after_comment lint rule that makes sure there is a
space or end of line after a comment. This is typically violated in
the case of parameter comments (the comments indicating what the
parameter name is for an argument in a function call). Since there
are so many violations of this, put off fixing it in the code until
pgindent is run. pgindent would fix it in an ugly way. For example:
fn(arg1 /* param1 */, arg2 /* param2 */);
would be autofixed by pgindent as
fn(arg1 /* param1 */ , arg2 /* param2 */ );
but a more standard fix would be
fn(arg1, /* param1 */
arg2); /* param2 */
since that is what appears in upstream postgres code. The plan is to
accept both variants for now.
- Add bad_spacing_before_comment lint rule that does the same but checks
spacing on the left side of a comment. Since there are fewer
violations of this, manually fix the areas in the code violating this
rule and make it error level.
Jira: DB-14745
Test Plan:
On Almalinux 8, zsh with EXTENDEDGLOB option:
[ -z "$(arc lint src/postgres/**/*.{c,h} | grep bad_spacing_before_comment)" ]
Close: #25487
Jenkins: skip
Depends on D40958
Reviewers: patnaik.balivada
Reviewed By: patnaik.balivada
Subscribers: patnaik.balivada, yql
Differential Revision: https://phorge.dev.yugabyte.com/D40990