fu: Close-up of Fu, bringing a scoop of water to her mouth (fu)fu ([staff profile] fu) wrote,
@ 2011-03-01 11:37 pm UTC
  • Previous Entry
  • Add to Memories
  • Tell someone about this!
  • Next Entry
You could tie perltidy to the mercurial commit hook, and use that as an automatic checker for style before commit.

We have so much old code in various styles, this would be much easier than tweaking things by hand to make everything conform, and once you've gotten past that first big burst of formatting, you could run it again and see any style issues in any new patches.

And yet, and yet...


(9 comments) - (Post a new comment)
(Flat) (Top-level comments only)

exor674: Computer Science is my girlfriend (cs is gf)


[personal profile] exor674
2011-03-01 06:16 pm UTC (link)
I really don't trust automatic code formatters, especially on large codebases.

One bug in the formatter, and it noms some $foo->prevent_xss_funtimes; check. *g*

(Reply to this)  (Thread


pauamma: Cartooney crab holding drink ("Cartooney crab holding drink")


[personal profile] pauamma
2011-03-01 06:46 pm UTC (link)
You could wrap it in something that pipes both original and tidied version through tr -d ' \n\t\v\f\r' and cmp the results.

(Reply to this)  (Thread from start)  (Parent)  (Thread


fu: Close-up of Fu, bringing a scoop of water to her mouth (fu)


[staff profile] fu
2011-03-02 03:52 am UTC (link)
Hmm' that's a neat trick.

Though maybe also diff --ignore-all-space might be close enough.

(Reply to this)  (Thread from start)  (Parent)  (Thread


pauamma: Cartooney crab holding drink ("Cartooney crab holding drink")


[personal profile] pauamma
2011-03-02 04:33 pm UTC (link)
That would still give spurious diffs when moving stuff across linebreaks, eg when rewriting
 

if ( $foo )
{
  bar();
  quux();
}


to
 

if ( $foo ) {
    bar();
    quux();
}


Last edited 2011-03-02 04:35 pm UTC (Bad HTML is bad.)

(Reply to this)  (Thread from start)  (Parent)  (Thread


fu: Close-up of Fu, bringing a scoop of water to her mouth (fu)


[staff profile] fu
2011-03-03 03:13 pm UTC (link)
Oh good point! (I'd probably still want to see those though, even if they're spurious, as a quick check).

(Reply to this)  (Thread from start)  (Parent


fu: Close-up of Fu, bringing a scoop of water to her mouth (fu)


[staff profile] fu
2011-03-02 03:54 am UTC (link)
Well, we'd be looking at the cleaned up version. It's the work that it would take to look at a cleaned up version of the code which is what gives me pause. I'm not sure I can justify taking time out from the day to justify working on this.

Oooh and I also want perlcritic, though we'd want to curate to only a subset of rules, but having things checked is easier than having to keep everything in your head!

(Reply to this)  (Thread from start)  (Parent


pauamma: Cartooney crab holding drink ("Cartooney crab holding drink")


[personal profile] pauamma
2011-03-01 06:30 pm UTC (link)
FRTA "perfidy is so tempting".

(Reply to this)  (Thread


fu: Close-up of Fu, bringing a scoop of water to her mouth (fu)


[staff profile] fu
2011-03-02 03:55 am UTC (link)
*snickers* Now I can't unsee it.

(Reply to this)  (Thread from start)  (Parent)  (Thread


pauamma: Cartooney crab holding drink ("Cartooney crab holding drink")


[personal profile] pauamma
2011-03-02 04:37 pm UTC (link)
*bow* Glad I could help.

(Reply to this)  (Thread from start)  (Parent



(9 comments) - (Post a new comment)
(Flat) (Top-level comments only)