← Back to team overview

launchpad-dev team mailing list archive

Re: RFC: change from using lint to using a pretty printer

 

On 14 June 2011 10:08, Robert Collins <robert.collins@xxxxxxxxxxxxx> wrote:
> On Tue, Jun 14, 2011 at 8:21 PM, Gavin Panella
> <gavin.panella@xxxxxxxxxxxxx> wrote:
[...]
>> I think that's a neat idea. but the pretty printer has to be
>> completely trustworthy. The moment it makes one wrong assumption
>> (*that we notice*) about what was intended we'll all be trying to
>> learn the tricks and intricacies of the pretty printer instead of just
>> writing code that others can read.
>
> I don't follow this. There are two failure modes in pretty printers:
>  a) cosmetic
>  b) functional
>
> If its a functional bug, we're going to notice when buildbot blows up on us.

It /may/ not blow up on us, but that would probably indicate
insufficient test coverage.

> if its a cosmetic bug, it will be consistent - but we don't need to
> worry about matching the pretty printer ourselves - anything we do
> different it will fixup-as-we-land.

I write code and format it in such a way that it makes sense to read,
and I bend the rules when it's likely to make the code easier to
read. The parser in my head really appreciates layout, whitespace and
other aesthetics like what colour comments are in Emacs. Some pieces
of code become familiar because of their *shape*. Code as art :)

I guess I'm a little wary of letting a machine make all of those
decisions for me. I also don't find that the cosmetic complaints from
the linter are particularly onerous to deal with.

I really like jml's point about making it easier for non-core people
to contribute, but I think prettification would ideally happen before
review, not during landing.

[...]
>> I'd also just prefer to know that what landed was what I wrote and
>> what was reviewed.
>
> Why? I'm not trying to troll - it genuinely doesn't seem like a useful
> thing to spend neurons on.

Mmm. I think I'm being irrational on that.

However, if I was working on a pipeline, I would be annoyed at having
to resolve conflicts in later branches when merging trunk because a
prettifier had changed my code. I can throw away the prettifier's
changes, once I realise that's what they are, but the act of figuring
that out and throwing away the changes negates in part the benefit of
having a prettifier.

Gavin.


Follow ups

References