On a related note, I wrote a few scripts to detect and correct some types of such style errors, see llvm/utils/lint/* . I also added a function to llvm/utils/vim/vimrc to delete trailing whitespace and highlight existing trailing whitespace -- if anyone's an Emacs-lisp hacker, please add it to the emacs config file as well. Sure, this doesn't enforce anything, but I'm hoping folks will start to use these tools and will over time clean up the style in the entire code base. 2009/2/20 Scott Michel <scooter.phd at gmail.com>> For the complete truth in advertising, this was pretty much a trial balloon > to gauge reaction. I'm not a big fan of rejecting commits for style > violations, but the dev guide has certain guidelines regarding formatting > and style. And we're all supposed to be good citizens... > > My biggest nit, however, was contemplating a commit where 80%+ was trailing > whitespace trimming. Yeah, my editor happens to practice good hygiene. I > could have been a complete *$$**le and committed a global hygiene patch. I > only touched the files that I'll end up committing in another day or two.I've been fixing things on a directory-by-directory basis as I come across style violations while browsing the code. I'm not in favor of a single global change to fix everything everywhere; I think this can be done gradually over time and the diff will be easier to read if it's smaller, so you can verify that the script (or your editor) did not mangle anything. Misha -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090220/ac1fa480/attachment.html>
> I also added a function to llvm/utils/vim/vimrc to delete trailing > whitespace and highlight existing trailing whitespace -- if anyone's > an Emacs-lisp hacker, please add it to the emacs config file as well.Usually this is done via develock minor mode (one can google for 'develock.el') --- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
On Feb 20, 2009, at 12:45 PM, Misha Brukman wrote:> I've been fixing things on a directory-by-directory basis as I come > across style violations while browsing the code. I'm not in favor > of a single global change to fix everything everywhere; I think > this can be done gradually over time and the diff will be easier to > read if it's smaller, so you can verify that the script (or your > editor) did not mangle anything.I've got a fairly simple perl script that trims trailing whitespace and it's remarkably effective. It even works over recursive directories (not hard to do, but it's the way to do this globally.) I'm sure it's not too much of a stretch to translate tabs to spaces, although that's controversial. -scooter
2009/2/20 Scott Michel <scottm at aero.org>> On Feb 20, 2009, at 12:45 PM, Misha Brukman wrote: > I've got a fairly simple perl script that trims trailing whitespace [...] >% cat llvm/utils/lint/remove_trailing_whitespace.sh #!/bin/sh # Deletes trailing whitespace in-place in the passed-in files. # Sample syntax: # $0 *.cpp perl -pi -e 's/\s+$/\n/' $* Yep, it's a one-liner.> [...] and it's remarkably effective. It even works over recursive > directories (not hard to do, but it's the way to do this globally.)With recursion into subdirectories: % remove_trailing_whitespace.sh `find . -name \*\.h`> I'm sure it's not too much of a stretch to translate tabs to spaces, > although that's controversial.Good point, I should add a verifier to the lint tool to check for tabs in non-Makefiles. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090220/c9cada97/attachment.html>
Apparently Analagous Threads
- [LLVMdev] svn pre-commit hook: help needed
- [LLVMdev] svn pre-commit hook: help needed
- [LLVMdev] svn pre-commit hook: help needed
- [LLVMdev] The one remaining bug keeping CellSPU from release...
- [LLVMdev] The one remaining bug keeping CellSPU from release...