Subject: | Add policy CodeLayout::ProhibitHardTabs |
We can add a policy that prohibits hard tabs, as recommended by PBP.
Interestingly, Damian's original version said "tabs for indentation, but NEVER after the beginning of the line". I completely concur.
He switched to "No tabs anywhere" because he felt that by allowing leading tabs, it would be too much of a temptation. Well then, we can fix that :)
Do the search as a straight up token search. That covers __END__ stuff and what have you.
sub wanted {
my ($Document, $Element) = @_;
$Element->isa('PPI::Token') or return '';
$Element->content =~ /\t/ ? 1 : '';
}
There needs to be an option to have EITHER just bitch about non-leading tabs (I suggest this as the default), or all tabs anywhere (the PBP strict version).
On a side note, I just got my funding for PPI phase 2 (infrastructure and taking PPI towards refacatoring editors), so I'm hoping to get a bit more involved with Perl::Critic some time soon.
The thing I really really want at this point would be Perl::Critic::Policy::AutoCorrectable. :)
I think you can guess what that would do.
Adam K