Opened 16 years ago

Closed 16 years ago

Last modified 14 years ago

#14165 closed defect (fixed)

port lint complains about trailing spaces on blank lines

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone: MacPorts 1.7.0
Component: base Version: 1.7.0
Keywords: Cc: afb@…
Port:

Description

When first implemented, port lint complained about trailing whitespace on blank lines. The code in portlint.tcl checked for this condition to decide whether to print the warning:

[string match "* " $line] || [string match "*\t" $line]

afb committed r28568 which was supposed to fix it, by changing the check to this:

[string match "* " $line] || [string match "*\t" $line] && [string trim $line] != ""

But in fact, this only fixed it if the trailing whitespace was a tab. If the trailing whitespace was a space, the erroneous warning is still printed. The check should have been:

([string match "* " $line] || [string match "*\t" $line]) && [string trim $line] != ""

But this can all be simplified to a single regular expression:

[regexp {\S[ \t]+$} $line]

Change History (5)

comment:1 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed

Fixed in r33705.

comment:2 Changed 16 years ago by afb@…

parentheses in Tcl always traps me up...

comment:3 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)

Yeah, I was a little surprised too! I didn't expect to need parens there. In any case, I like the regular expression solution better. :)

comment:4 Changed 15 years ago by tobypeterson

Milestone: MacPorts base bugsMacPorts Future

Milestone MacPorts base bugs deleted

comment:5 Changed 14 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 1.7.0
Note: See TracTickets for help on using tickets.