[openstack-dev] Remove vim modelines?
Robert Collins
robertc at robertcollins.net
Thu Oct 24 18:48:18 UTC 2013
I guess I get to buck the trend :).
On 25 October 2013 01:38, Joe Gordon <joe.gordon0 at gmail.com> wrote:
> Since the beginning of OpenStack we have had vim modelines all over the
> codebase, but after seeing this patch
> https://review.opeenstack.org/#/c/50891/ I took a further look into vim
> modelines and think we should remove them. Before going any further, I
> should point out these lines don't bother me too much but I figured if we
> could get consensus, then we could shrink our codebase by a little bit.
>
> Sidenote: This discussion is being moved to the mailing list because it
> 'would be better to have a mailing list thread about this rather than bits
> and pieces of discussion in gerrit' as this change requires multiple
> patches. https://review.openstack.org/#/c/51295/.
I don't deeply care about them, but I think the logic being used to
promote their removal is flawed.
> Why remove them?
>
> * Modelines aren't supported by default in debian or ubuntu due to security
> reasons: https://wiki.python.org/moin/Vim
This affects folk who haven't turned it on. We have no idea about how
many that is. The presumption is that if it's off by default everyone
has it off - but one of the first things most folk end up doing with
vim as they head down the path to poweruser is customing their
vimrc...
> * Having modelines for vim means if someone wants we should support
> modelines for emacs
> (http://www.gnu.org/software/emacs/manual/html_mono/emacs.html#Specifying-File-Variables)
> etc. as well. And having a bunch of headers for different editors in each
> file seems like extra overhead.
This is a slippery slope argument. We could equally say 'it's up to
the editors to support our style declaration, use a vim-compatible
plugin in your editor'. We can also say 'we'll directly support the
three most common editors' and gather data on that from our developer
surveys. (We /do/ gather developer data don't we? :) ).
> * There are other ways of making sure tabstop is set correctly for python
> files, see https://wiki.python.org/moin/Vim. I am a vIm user myself and
> have never used modelines.
The other ways won't help folk that
> * We have vim modelines in only 828 out of 1213 python files in nova (68%),
> so if anyone is using modelines today, then it only works 68% of the time in
> nova
That seems like a reason to add it to all files to me ;).
> * Why have the same config 828 times for one repo alone? This violates the
> DRY principle (Don't Repeat Yourself).
The same argument applies to copyright licences, .py file suffixes and
common imports.
I do agree that the repeated unchanging nature of modelines is
suboptimal, and it would be
nice to be able to define the style hints to vim for an entire subtree.
This is probably possible through a little bit of scripting.
Since you skipped it, I should add a case for pushing modelines everywhere.
*) They help everyone when editing files where the format is less well
known than Python (.yaml for instance) or our style guide doesn't
match a global document (shell scripts, docbook).
*) They help casual contributors *more* than long time core
contributors : and those are the folk that are most likely to give up
and walk away. Keeping barriers to entry low is an important part of
making OpenStack development accessible to new participants.
*) We can move them to the very end of the file where ~nobody will see them.
*) We can teach hacking to enforce a specific modeline per file type,
avoiding accidental mistakes.
*) Possibly we can move the copyright licence grants to the end of the
files as well, making opening our source code up much more pleasant.
Cheers,
Rob
--
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud
More information about the OpenStack-dev
mailing list