testlint
testlint copied to clipboard
false positive on variable named temperature and Regex bug
Firstly, thanks for this. It's very helpful while I try to unlearn ingrained habits when writing swift!
I fixed the false positive by including word boundaries around the relevant triggers as follows:
if ([RegexHelper testString:@"\\Btemp\\B" inString:line] ||
[RegexHelper testString:@"\\Btmp\\B" inString:line] ||
[RegexHelper testString:@"\\Bresults\\B" inString:line] ||
[RegexHelper testString:@"\\BreturnValue\\B" inString:line])
{
I'm not entirely sure about them around other than temp, since your intent may be to also prevent things like tmpfoo. - Speaking of which, you may want to add foo, bar, foobar to the list :)
Also, in your original code, you don't ignore case, so, e.g. Temp passes.
- Actually, after looking at the code in RegexHelper.m, I saw that you have the option in the wrong method. (I moved it and it worked)
(Normally, I'd submit a change, but I have several other checks disabled and so have other changes to your code. Also, the above should be clear and trivial enough that it didn't seem to be necessary either).