On Mon, Dec 17, 2018 at 05:31:22PM -0500, Tom Lane wrote:
> David Fetter <david@fetter.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