Standardizing the file header?

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Standardizing the file header?
Date: 2024-12-16 16:44:57
Message-ID: ntru2q43lfvcrlvprs5pubmevxreyp2r5rplhoogrqbctrruyg@jg2rfn5jkvge
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Every time I create a new file that I want to write a file header comment for
I get confused about the order in which we write them.

The main "patterns" seem to be

/*-------------------------------------------------------------------------
*
* $filename
* $oneline_description
*
* $longform_description
* $over_multiple_lines
*
* $copyright
*
* IDENTIFICATION
* $file_path
*
*-------------------------------------------------------------------------
*/

/*-------------------------------------------------------------------------
*
* $filename
* $online_description
*
* $copyright
*
*
* IDENTIFICATION
* $file_path
*
* NOTES
* $longform_description
* $over_multiple_lines
*
*-------------------------------------------------------------------------
*/

Although there quite a few other patterns.

There's also a fair bit variation about how far the indented sections are
indented, even if otherwise using the same pattern. Just looking at the path
in the line after IDENTIFICATION:

$ git grep -h -A1 'IDENTIFICATION'|grep -v IDENTIFICATION|grep '*'|sed -E -e 's/^( ?\*[ \t]+)[a-z].*$/>\1</' -e 's/\t/t/g' -e 's/ /w/g'|sort|uniq -c
1 >*t<
1 w*
10 >w*t<
92 >w*tt<
27 >w*ttt<
3 >w*tttw<
52 >w*ttww<
865 >w*tww<
10 >w*twww<
2 >w*ww<
12 >w*wwww<
2 >w*wwwwww<
4 >w*wwwwwww<

There are also a few files that don't have the filename on the third lines and
that don't use "IDENTIFICATION".

It probably doesn't make sense to change all the existing files to follow one
pattern (although perhaps some of the "more odd" ones might be worth
adjusting).

But it seems like it'd be good to define one pattern as canonical so one
doesn't have to guess what pattern one should follow when creating a new file.

Thoughts?

Greetings,

Andres Freund

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2024-12-16 17:05:59 Re: FileFallocate misbehaving on XFS
Previous Message Tomas Vondra 2024-12-16 16:40:59 Re: Add missing tab completion for ALTER TABLE ADD COLUMN IF NOT EXISTS