-
Notifications
You must be signed in to change notification settings - Fork 153
FC006 - not detecting 4-digit numbers #125
Comments
Hi Mike, Thanks for raising this. For FC006 we allow the mode to be specified as four unquoted numbers, but only where the first number is a zero. See #9 for the background detail on this. I think we left this case out of the rule documentation to try to avoid making the message too confusing. Thanks, Andrew. |
Thanks for the explanation. That tells me that this is a docs bug, and should be addressed. :) -M |
Ha. The existing docs do over-simplify but with the intent of making the rule to follow easier to remember - just quote the mode or specify at least five digits. If you would like to submit a pull request to add "four digits are ok but only if the first digit is a leading zero" then that's totally cool, but let's try not to make it confusing. |
@acrmp I would personally prefer if Foodcritic picked a way and enforced it. Part of being a linter is enforcing consistency, even if it's not "wrong" to do it the other way. |
Does anyone else have strong feelings on this? In my opinion quoting is preferred but I'm not keen to raise FC006 which is a |
My feeling is: If it can go wrong, it will, and it will leave a new user scratching their head in wonderment. If you can make logic work for:
then that covers it. |
Oh, and it should probably be more "style" than "correctness" if it's a stylistic choice and won't break something, |
@miketheman I'm not quite following you.
|
Then I believe this goes back to my original question. The docs surrounding this are misrepresenting the desired behavior. The rule is of correctness, so if the conditions are all there for testing the scenarios and report if there's something wrong, then cool. The docs read "... either quote the octal number or ensure it is specified to five digits..." - so the docs might need an update to reflect allowing 4-digit, leading 0 permissions masks. The reason I think we should go "string or 5-digit" is Ruby's While it is correct-enough to have 4-digit leading 0, then maybe we need a Basically, I think it's time for FC to become somewhat opinionated about certain styles, and "recommend" them. The term "best practices" that everyone seems to ask for keeps coming up, and style is part of that, as it's not correctness. |
Closing due to inactivity. |
Consider:
According to the docs, this rule should be triggered when not a 5-digit octal mode. Are the docs wrong, or is FC wrong?
The text was updated successfully, but these errors were encountered: