defluffing Portfiles (port lint)

Ryan Schmidt ryandesign at macports.org
Tue Jul 10 15:15:23 PDT 2007


On Jul 10, 2007, at 16:31, Anders F Björklund wrote:

> Ryan Schmidt wrote:
>
>> There has been some debate on whether to use tabs or spaces.  
>> Different people have different opinions on this, with people on  
>> both sides claiming that their way is easier for them and/or their  
>> text editors.
>
> While at the same time making it harder for everyone reading...
> I think it's a poor tradeoff, better to pick One True Portstyle.
>
>> I use tabs to control indentation at the beginnings of lines, but  
>> spaces to keep columns aligned. This seems like the best idea to  
>> me. Many portfiles currently use tabs everywhere, even to keep  
>> columns aligned, which of course fails if I'm using different tab  
>> settings than the portfile author. Other portfiles use spaces  
>> everywhere.
>
> The simple solution being defining tabs to something like 8.

To bring back some of the arguments from earlier threads: I do not  
wish to configure my editor to use 8-space tabs. I prefer 4-space  
tabs. This is why editors let you change the tab width: because it's  
a personal preference. Do not force your personal preferences on me.  
Different people prefer 4- or 8- or 2- or 3-space tab settings in  
their editors, and that's just fine. They should be allowed to do  
that. But this is the reason why using tabs to keep columns aligned  
is a bad idea and should not be done -- columns become unaligned for  
all tab-width settings other than the one the author used. This is  
also a reason why using spaces everywhere, even for line indentation,  
is bad IMHO: it forces your personal line indentation preference on  
everyone else.

> Or use spaces everywhere. Just as long as it is consistent ?

I'd prefer not to use spaces everywhere, because I like using the tab  
key and other indentation functions of my editor, which uses the tab  
character. I do not wish to reconfigure my editor to use space  
characters because I use tab characters in all the other non-MacPorts  
text files that I edit with my editor.

This is why I believe tabs at the beginning of lines and spaces  
within lines is the best solution. I can continue to use the tab key  
to indent lines, which I'm used to. I can continue to use my editor's  
increase-indentation and decrease-indentation functions, which also  
use tab characters. And for keeping columns aligned, I can use  
spaces, and regardless of my or your tab indentation preferences, the  
columns remain aligned.

However, if it is decided to enforce only spaces everywhere and  
banish the tab character, then so be it. But then I will likely need  
to develop some scripts which convert portfiles to and from tabbed  
format, so that I can deal with them easily in my editor. Or I will  
have to write a script which I will then use to open portfiles, which  
configures the editor to use only spaces, only for that one file.

Other users will of course argue that their editors are configured to  
use spaces, and they do not wish to reconfigure their editors to use  
tabs... I think this is where we stalemated last time.





More information about the macports-dev mailing list