You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request]: Handle new Bicep linter warning prefer-unquoted-property-names #1664
Recently, a new Bicep linter warning prefer-unquoted-property-names was introduced which leads to a large amount of warnings regarding our modules.
The primary reason are our nested RBAC modules (nested_roleAssignments.bicep) as they contain a map of RoleName - RoleID mappings, and the RoleName is always formatted as a string.
This was originally done to make the list easy to read (i.e., consistent formatting), but we may want to revisit that decision now.
For the time being, with PR #1632, the warning is disabled. If we want to enable it again, we should make sure all our modules align with the new rule.
Team decided not to follow the linter recommendation. To still not be bothered by this warning, a bicep config file needs to be set up.
TODO: This should also be mentioned in the "known issues".
Team decided not to follow the linter recommendation. To still not be bothered by this warning, a bicep config file needs to be set up. TODO: This should also be mentioned in the "known issues".
Hi Rainer Halanek (@rahalan),
thanks for the update, can you please add the reasoning for deviating from the official bicep team recommendations here?
Declaring separate linter configurations in this repository makes it more difficult for customers to integrate the CARML library, as they normally have their own linter configurations already and from my experienced with bicep projects, the prefer-unquoted-property-names is used for internal linting a lot. So an official reasoning, why they have to configure the bicep linting in another way than recommended by the bicep team is necessary to be able to integrate CARML modules in the future.
Hey Jan-Henrik Damaschke (@itpropro),
even though I'd support the motion, a quorum decided to leave it as is for because a mix of quoted and unquoted strings in the list appears to confuse more than it helps & the generating utility would need to be updated too.
In the bicepconfig.json it says
{
"analyzers": {
"core": {
"rules": {
(..)"prefer-unquoted-property-names": {
"level": "off"// Reason: This complains primarily about RBAC roles which are all in quotes to be consistent within the list of roles with and without spaces in their name
}
}
}
}
}
However, Erika Gressi (@eriqua) provided the alternative suggestion to a ignore rules in the RBAC files instead. This would mean 4/5 lines per file, but we could keep the linter rule for everyhing else active - as it is a good rule.
Hey Jan-Henrik Damaschke (@itpropro), even though I'd support the motion, a quorum decided to leave it as is for because a mix of quoted and unquoted strings in the list appears to confuse more than it helps & the generating utility would need to be updated too.
In the bicepconfig.json it says
{
"analyzers": {
"core": {
"rules": {
(..)"prefer-unquoted-property-names": {
"level": "off"// Reason: This complains primarily about RBAC roles which are all in quotes to be consistent within the list of roles with and without spaces in their name
}
}
}
}
}
However, Erika Gressi (@eriqua) provided the alternative suggestion to a ignore rules in the RBAC files instead. This would mean 4/5 lines per file, but we could keep the linter rule for everyhing else active - as it is a good rule.
I think the suggestion from Erika Gressi (@eriqua) for a ignore rules in the RBAC files is a good compromise. This way, customers are still able to use their own linter rules and can keep their linter configs intact without getting warnings thrown.
Activity
rahalan commentedon Aug 18, 2022
Team decided not to follow the linter recommendation. To still not be bothered by this warning, a bicep config file needs to be set up.
TODO: This should also be mentioned in the "known issues".
itpropro commentedon Sep 8, 2022
Hi Rainer Halanek (@rahalan),
thanks for the update, can you please add the reasoning for deviating from the official bicep team recommendations here?
Declaring separate linter configurations in this repository makes it more difficult for customers to integrate the CARML library, as they normally have their own linter configurations already and from my experienced with bicep projects, the
prefer-unquoted-property-namesis used for internal linting a lot. So an official reasoning, why they have to configure the bicep linting in another way than recommended by the bicep team is necessary to be able to integrate CARML modules in the future.AlexanderSehr commentedon Sep 30, 2022
Hey Jan-Henrik Damaschke (@itpropro),
even though I'd support the motion, a quorum decided to leave it as is for because a mix of quoted and unquoted strings in the list appears to confuse more than it helps & the generating utility would need to be updated too.
In the
bicepconfig.jsonit says{ "analyzers": { "core": { "rules": { (..) "prefer-unquoted-property-names": { "level": "off" // Reason: This complains primarily about RBAC roles which are all in quotes to be consistent within the list of roles with and without spaces in their name } } } } }However, Erika Gressi (@eriqua) provided the alternative suggestion to a ignore rules in the RBAC files instead. This would mean 4/5 lines per file, but we could keep the linter rule for everyhing else active - as it is a good rule.
AlexanderSehr commentedon Sep 30, 2022
Attached a Draft PR for reference
itpropro commentedon Oct 3, 2022
I think the suggestion from Erika Gressi (@eriqua) for a ignore rules in the RBAC files is a good compromise. This way, customers are still able to use their own linter rules and can keep their linter configs intact without getting warnings thrown.
rahalan commentedon Oct 13, 2022
Team decides to go with the rule and remove quotes on single strings.
Team decides to go for having all roles in alphabetical order, regardless which one has quotes, see https://github.com/Azure/ResourceModules/pull/2200/files