Open russplaysguitar opened 11 years ago
==
should be used instead of EQ
!=
should be used instead of NEQ
&&
should be used instead of AND
||
should be used instead of OR
CONTAINS
and DOES NOT CONTAIN
supposedly aren't valid in cfscript anyways (haven't tested that, though).
For string comparisons, compare()
(or compareNoCase()
) should be used instead of IS
and IS NOT
.
I see. Well it's up to you, but this would be one of the ones I don't agree with (not that you asked). I see this sort of thing as entirely personal preference, so not a good fit here.
Amusingly, this works in CFScript just fine, btw: result = a greater than or equal to b;
And, no, I would never do that. I personally prefer the C-style operators over the Perl-style ones, but I'd not enforce that on anyone else. YMMV obviously
yeah, that's the thing about linters: that they kinda force their code-style on everyone. that is why i wanted to get opinions before starting work on it.
i think all of the rules should be optional (but 'on' by default). maybe each rule could be set to one of: 'off', 'warn', or 'fail'.
i did see this one on a few cfml best practices guides, but maybe i should create a survey after we're done discussing and gathering potential rules?
Ah right, I see. Yeah, I think it's fine provided it can be switched off: or even not. Even then when I run JSLint I ignore half the stuff it says cos my opinion is "nah, that's a crap rule", and I imagine I'm not the only one ;-)
just to clarify: do you prefer those operators in cfscript as well as tags?
Yep. NB: PERL now has the == styles ones too, so when I said Perl-style before, I meant "EQ" etc: the alphabetical ones. So I prefer the same ones you were thinking of enforcing the use of (==, !=, &7, || etc), but I just wouldn't be enforcing it.
okay cool
:+1: for the rule. also :+1: for having every rule be defaulted to "fail" but optionally set to warn/off.
The use of "decision operators" should cause lint failures. Examples
IS
,IS NOT
,EQ
,NEQ
, etc...Boolean operations should be used instead.