Skip to content

[Feature Request]: Handle new Bicep linter warning prefer-unquoted-property-names #1664

Closed

Description

Description

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.

image

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.

cc: Jan-Henrik Damaschke (@itpropro)

Activity

  1. rahalan commented on Aug 18, 2022

    @rahalan
    Contributor

    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".

  2. added
    documentation
    and removed on Aug 18, 2022
  3. itpropro commented on Sep 8, 2022

    @itpropro
    Contributor

    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.

  4. AlexanderSehr commented on Sep 30, 2022

    @AlexanderSehr
    ContributorAuthor

    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.

  5. AlexanderSehr commented on Sep 30, 2022

    @AlexanderSehr
    ContributorAuthor

    Attached a Draft PR for reference

  6. itpropro commented on Oct 3, 2022

    @itpropro
    Contributor

    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.

  7. rahalan commented on Oct 13, 2022

    @rahalan
    Contributor

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

documentationenhancement

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions