defluffing Portfiles (port lint)

Anders F Björklund afb at macports.org
Tue Jul 10 14:31:53 PDT 2007


Ryan Schmidt wrote:

>> It does highlight some portstyle issues to be sorted out,
>> like where the newlines should go and amounts of tabbing.
>
> Seems like coding style has thus far been left up to each port author.

Yup, seems like it. Or up to general rules or customs, rather
than verifying it automatically against some common standard.

> 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.
Or use spaces everywhere. Just as long as it is consistent ?

> I think the idea of portlint was supposed to be a utility that checks 
> for valid syntax, valid variables, required variables and so on, but I 
> don't know that it needs to enforce any particular coding style -- 
> especially not until there is a clear consensus about what that style 
> should be. The last time we tried to settle even the tabs-vs.-spaces 
> issue there was a heated debate and no resolution.

The whining about whitespace can be made into an option, I'm
just not familiar enough with the MacPorts API to make it one...

> The style of my portfiles should be consistent with each other -- with 
> perhaps a few exceptions for portfiles I haven't gotten to yet. But my 
> port writing style is different from some others. Since we had no real 
> consensus on style, I wanted to try something different to see how I 
> liked it. So far, I kinda do.

The main idea of making the actual tool was to see how much
differences there actually is, in terms of hard port numbers ?

Haven't actually gotten around to doing the "port lint all"
yet, just as I haven't done "port rpm all" just yet either :-)

--anders




More information about the macports-dev mailing list