Azure / Azure/bicep

Linter - Improve template governance by supporting metadata linting

Open
#14,096 0 comments 2 reactions 0 assignees View on GitHub
enhancement Needs: Upvote
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 2h
Merged PRs (30d)
79

Description

**Is your feature request related to a problem? Please describe.**
The metadata keyword is great for improving template governance. We can implement metadata properties like: `version` or `author`.
While the existence and formatting of these "properties" are easy to validate programmatically by compiling the template and extracting the properties, we are unable to have rules stating that certain properties are required, and even potentially the formatting of those properties through VS Code.

**Describe the solution you'd like**

Some options could include:

## Require properties

An option in the .bicepconfig linter options where I can specify required metadata properties.

Example:
```jsonc
// bicepconfig.json
{
// ...
"analyzers": {
"core": {
"rules": {
"required-metadata-properties": {
"level": "Error",
"properties": [
"author",
"version"
]
}
}
}
}
// ...
}
```

## Require version property

The most important property to have would be the `version` property. With this option, it could enforce the semver format for the property.

Example:

```jsonc
// bicepconfig.json
{
// ...
"analyzers": {
"core": {
"rules": {
"require-metadata-version-property": {
"level": "Error"
}
}
}
}
// ...
}
```

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating the linter configuration handling and metadata extraction, then determine how required properties and version-format validation would fit the proposed .bicepconfig rules. Done means the selected metadata rules are configurable and their diagnostics are covered by tests.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.