warpnet / salt-lint

A command-line utility that checks for best practices in SaltStack.
https://salt-lint.readthedocs.io/en/latest/
MIT License
152 stars 39 forks source link

Add rule 218 File mode Single quotation rule #279

Closed jtprogru closed 1 year ago

jtprogru commented 2 years ago

In documentation is written:

When using a mode that includes a leading zero you must wrap 
the value in single quotes. If the value is not wrapped in quotes 
it will be read by YAML as an integer and evaluated as an octal.
sblaisot commented 1 year ago

Isn't this already covered by rule 207 ?

jtprogru commented 1 year ago

Yes, correctly using is '0755' – single quote – rule 207 is covered, but if I using a "0755" – double quote – salt-lint can't find this problem.

sblaisot commented 1 year ago

Double quote is not a problem AFAIK.

Single and double quote string marker in yaml makes no difference IIUC (except for backslash representation of special chars which is not the case here) https://yaml.org/spec/1.2.2/#73-flow-scalar-styles

What problem are you trying to catch?

jtprogru commented 1 year ago

I try to standardize all code in my infrastructure repo =) Maybe change severity for this rule - 218 – to 'INFO'.

roaldnefs commented 1 year ago

@jtprogru, thank you for the contribution! Although the wording might suggest otherwise, it's allowed to wrap the digit in double quotes in YAML.

You can always use this rule by specifying the -r RULESDIR combined with the -R.