bicep icon indicating copy to clipboard operation
bicep copied to clipboard

Linters: ability to configure the "default" level for new analyzers

Open anthony-c-martin opened this issue 2 years ago • 2 comments

Problem Statement

If a new analyzer is added, it generally will be added with a level of "warning". Once the rule has been added, it's possible to upgrade the level to "error" with the following:

{
    "analyzers": {
        "core": {
            "rules": {
                "my-new-rule": {
                    "level": "error"
                }
            }
        }
    }
}

However, this is only possible to do after the rule has been added. There's no way possible to default all new linter rules to "error".

Suggestion

Something like the following would be nice, for users wanting to be ultra strict with their build process:

{
    "analyzers": {
        "defaults": {
            "level": "error"
        },
        "core": {
            "rules": {
                "rule-with-warning-override": {
                    "level": "warning"
                }
            }
        }
    }
}

It may also be useful to have the ability to block certain rules from being overridden in-line:

{
    "analyzers": {
        "defaults": {
            "level": "error",
            "allow-inline-disable": false
        },
        "core": {
            "rules": {
                "rule-with-warning-override": {
                    "level": "warning",
                    "allow-inline-disable": true
                }
            }
        }
    }
}

anthony-c-martin avatar Apr 03 '23 14:04 anthony-c-martin

@anthony-c-martin Thanks for entering. I suggested exactly this here, and also in a community call, but saw very little interest.

image

However, the main reason I haven't impemented the current proposal in https://github.com/Azure/bicep/issues/8013 is that I'm convinced we do need the capability to deal with this and also builds breaking caused by new rules. I'll spend some time soon getting a final proposal together. Would like to get this out of the way.

It may also be useful to have the ability to block certain rules from being overridden in-line:

This was actually requested by BMoore and is tracked here: https://github.com/Azure/bicep/issues/5377, will add your comments there.

StephenWeatherford avatar Apr 03 '23 16:04 StephenWeatherford

Related to https://github.com/Azure/bicep/issues/4719

StephenWeatherford avatar Apr 17 '23 23:04 StephenWeatherford