Closed (fixed)
Project:
Coder
Version:
6.x-1.x-dev
Component:
Review/Rules
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Sep 2008 at 19:20 UTC
Updated:
12 Oct 2008 at 03:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
stella commentedAttached patch should fix this issue.
I could have changed the regex to:
However this would then miss trailing spaces in the string if the string itself contained a single or double quote. I've tried to over come this scenario by changing the rule to:
This should do the current match, but should then exclude matches where there is a quote followed by a space and something which is not a comma/bracket and which is also terminated by a quote and a comma/bracket which isn't prepended by a space. Hope that makes sense.
So the following checks should now be alerted upon:
but won't alert on:
I'm pretty confident this works, but I'd like it if someone could test it and confirm.
Cheers,
Stella
Comment #2
douggreen commentedThis fails two tests.
Comment #3
stella commentedOk, here's a slightly modified one. It catches all 6 tests.
Cheers,
Stella
Comment #4
stella commentedComment #5
douggreen commentedThanks! Committed. BTW, Coder is now passes all coder tests (although we still need to convert many :)
Comment #6
stella commentedHmmm, this might need more work. It's now not catching lines like these:
Comment #7
stella commentedThe first patch has already been committed, so this one is in addition to the above one. It should now catch most of the above scenarios. It catches all but the first one, where there is a nested t(). I'm not sure how to change the code to catch this, or even is something we should be trying to handle. Are nested t()s really valid? I'm inclined to think not.
The other scenario where it may not work is:
i.e. where there is more than one t() call on the same line, and the last one has a trailing space and the last one also contains a closing ). The chances of this are probably slim enough, though it could probably be fixed with a bit more effort. I do think this patch is an improvement in any case - just try some of the new test cases with the old rule to see.
Oh it also checks for leading/trailing spaces in get_t() and st() too.
Cheers,
Stella
Comment #8
douggreen commentedCommitted, I added one test to your additional tests. Thanks!
Comment #9
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.