Re: Copypasta in the PostgreSQL source

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Copypasta in the PostgreSQL source
Date: 2018-12-17 23:36:55
Message-ID: 20181217233655.GE416@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 17, 2018 at 05:31:22PM -0500, Tom Lane wrote:
> David Fetter <david(at)fetter(dot)org> writes:
> > Please find attached a run of a tool that looks for duplicated
> > tokens. I've removed some things that seem like false positives,
> > basically all from the stemmer part of the source, but there's
> > still a lot.
>
> I thought you were talking about problems like "that that" typos,
> but on looking at the file, what this is actually complaining about
> is any duplicated code segments anywhere. I do not find this
> helpful. Refactoring to the point that dozen-line code stanzas
> never appear more than once would be incredibly invasive, likely
> very bad for performance, and I don't think it'd improve readability
> either.

Is there a threshold, possibly much larger than a dozen lines, where
such refactoring would actually make sense?

> > - Would it make sense to make some kind of git commit trigger that
> > at least warns when a new one has been introduced?
>
> Commit triggers are NOT the place for heuristics about code quality,
> even if they're well-considered heuristics.

Where's a better place for such heuristics? I'd like to think that
there are opportunities for more automation than we currently have, on
that score. Maybe a `make` target?

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2018-12-17 23:38:16 Re: explain plans with information about (modified) gucs
Previous Message Andres Freund 2018-12-17 23:35:01 Re: Valgrind failures in Apply Launcher's bgworker_quickdie() exit