mugle-dev team mailing list archive
-
mugle-dev team
-
Mailing list archive
-
Message #00271
Re: Mixing tabs and spaces
> You could always use eclipse instead of vim :-p
Well that won't really change the fact that the code is formatted horribly
and every time I view a diff or any code at the command line I will see an
unreadable mess, not to mention indenting or moving the cursor around the
screen will have unexpected results. I could also turn off visible tabs in
vim, but that would only hide the fact that every action I take is
potentially changing the indentation of the code as an unintended
side-effect. As I said, pedantic, but we are software developers. It is our
job to be pedantic.
Anyway, I have made the epic change and I apologise to the revision control
gods for changing about half of the lines in the entire project in a single
commit, but hopefully it will be much easier to deal with now.
Please install the Bazaar plugin and set your text editors appropriately. I
have put some advice under doc/platform, which I will repeat here:
Set your text editor to convert all tabs into spaces. In Eclipse, Window ->
Preferences -> General -> Editors -> Text Editors -> Insert spaces for tabs.
Install bzr-text-checker <https://launchpad.net/bzr-text-checker> to prevent
you from accidentally committing code with spaces. To do this, type:
$ mkdir ~/.bazaar/plugins$ bzr branch lp:bzr-text-checker
~/.bazaar/plugins/text_checker
Then create a file called ~/.bazaar/rules with the following contents:
[name *]tabs=failnewline_at_eof=failcheck_eol_type=lfcheck_eol=fail
You may also like to add trailing_whitespace=fail and/or
long_line_length=78, long_lines=warn, but that is a personal preference (we
don’t require files not to have trailing whitespace or short lines, though
you should try to avoid having too many long lines).
Note that I have removed the trailing_whitespace and the long line
requirement. They will be problematic to enforce, as I think Eclipse leaves
trailing whitespace by default (grr). So I don't mind if you leave lines
with spaces at the end; you should probably just use the smaller rules file
I put in above.
References