| From: | Bruce Momjian <bruce(at)momjian(dot)us> | 
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
| Cc: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: perlcritic and perltidy | 
| Date: | 2018-05-25 19:04:45 | 
| Message-ID: | 20180525190445.GA2213@momjian.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On Sun, May  6, 2018 at 11:53:34AM -0400, Tom Lane wrote:
> What sort of changes do we get if we remove those two flags as you prefer?
> It'd help to see some examples.
> 
> Since we just went to a new perltidy version, and made some other
> policy changes for it, in HEAD, it'd make sense to make any further
> changes in this same release cycle rather than drip drip drip over
> multiple cycles.  We just need to get some consensus about what
> style we like.
I saw you looking for feedback so I wanted to give mine.  Also, Andrew,
thanks for working on this --- it is a big help to have limited Perl
critic reports and good tidiness.
I am using the src/tools/pgindent/perltidyrc setting for my own Perl
code, but needed to add these two:
	--noblanks-before-comments
	--break-after-all-operators
The first one fixes odd blank lines when I put comments inside
conditional tests, e.g.:
        if (!$options{args_supplied}               &&
                !$is_debug                             &&
                defined($stat_main)                    &&
                defined($stat_cache)                   &&
                $stat_main->mtime < $stat_cache->mtime &&
                # is local time zone?
                (!defined($ENV{TZ}) || $ENV{TZ} =~ m/^E.T$/))
Without the first option, I get:
        if (!$options{args_supplied}               &&
                !$is_debug                             &&
                defined($stat_main)                    &&
                defined($stat_cache)                   &&
                $stat_main->mtime < $stat_cache->mtime &&
-->
                # is local time zone?
                (!defined($ENV{TZ}) || $ENV{TZ} =~ m/^E.T$/))
which just looks odd to me. Am I the only person who often does this?
The second option, --break-after-all-operators, is more of a personal
taste, but it does match how our C code works, and people have said I
write C code in Perl.  ;-)
-- 
  Bruce Momjian  <bruce(at)momjian(dot)us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com
+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2018-05-25 19:05:42 | Re: Performance regression with PostgreSQL 11 and partitioning | 
| Previous Message | Robbie Harwood | 2018-05-25 18:58:10 | Re: [PATCH v16] GSSAPI encryption support |