feat: new linter rules to enforce descriptions on types, params, var, type properties and output - #20036
Conversation
|
Documentation is needed for this |
|
Anthony Martin (@anthony-c-martin) does anyone on the team have time for a review? 😃 |
|
John (@johnlokerse) does it works for types as well? Would be very good if it applies to types as well or if there is separate rule for it. There is one exception for types though - discriminator. for the example below it should not apply as the description for foo is where foo is referenced. If there is description directly on the type it does not appear anywhere. ...
@discriminator('type)
type foo = foo1 | foo2
... |
Stanislav Zhelyazkov (@slavizh) This can be done. I would do it separately from this linter, though, since not everyone wants to put descriptions on properties in types or on the type itself. The same thing applies to variables and outputs if you ask me. Or as another option we introduce a configuration to the new "analyzers": {
"core": {
"rules": {
"use-recent-api-versions": {
"level": "warning",
"maxAllowedAgeInDays": 500
},
"use-descriptions": {
"level": "error",
"variables": false,
"userDefinedTypes": true,
"parameters": true,
"outputs": true
}
}
}
} |
John (@johnlokerse) - the changes in this PR look good to me, but I think it would be a good idea to close on this discussion first - I wouldn't want to release something and then immediately change it. |
I agree. Anthony Martin (@anthony-c-martin) Stanislav Zhelyazkov (@slavizh) What is your take on the proposed configuration in the |
What would the "default" behavior be - just parameters? Another option to consider for how you express this in config is with an array of enums - e.g.: "use-descriptions": {
"level": "error",
"requireOn": ["parameter", "type", "typeProperty", "output"]
} |
|
Anthony Martin (@anthony-c-martin) looks good to me. For parameters by default the highest could be only warning otherwise it will be a breaking change. I am ok to be a warning instead of off. For the others from my perspective they should be warnings by default but I think that might be too aggressive for many users and I do not know if they will react positively on it. Note that the exception on discriminator type is important as that description does not really appear anywhere when it is standalone type referenced. |
|
Anthony Martin (@anthony-c-martin) Looks good to me too, and I like the
If we choose the same approach as the Stanislav Zhelyazkov (@slavizh) I agree on the |
|
John (@johnlokerse) note my suggestion is not based on what is popular but rather what should be the best practice. For example you will see most folks using multiple parameters trying to implement different features for different services that are deployed within the same module instead of trying to group those into a single parameter per resource. Very small example: vs. The latter has a ton of benefits that makes the user experience of modules better. Unfortunately even AVD is implementing that partially. One of the reason for not being widely used is that most folks moved from ARM templates where we did not have such features and everything was flat. Another is that the Portal does not supports such types very well thus the examples created by Microsoft employees also have flat structure. However this is another topic. Overall I think the standard values should represent the desired standard for coding even if it is not what is widely used in order to promote that standard. I also know that some warnings might be annoying in simple scenarios. |
|
John (@johnlokerse), I'm happy defaulting to "off" for everything, because of the sheer quantity of .bicep files this would flag if enabled by default.
Good point! I'm fine either way. I think there's benefit to the ease of enabling/disabling if we create separate linters for each. |
Anthony Martin (@anthony-c-martin) Okay, so let's keep it consistent with the other linter rules. We default to
Additionally, documentation needs to be created. Will use the same style as this page: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/linter-rule-no-unused-parameters. Do I miss anything? If not, I will start building and will update this PR with the new linter rules. 😃 |
Sounds good to me! |
|
Hey John (@johnlokerse) & Anthony Martin (@anthony-c-martin), I've started documenting the "use-parameter-descriptions" rule in an internal draft. I do have a question. In src/Bicep.Core/Analyzers/Linter/Rules/UseParameterDescriptionsRule.cs & src/vscode-bicep/schemas/bicepconfig.schema.json, I see "use-parameter-descriptions" being used. Will this perhaps change to
|
Anthony Martin (anthony-c-martin)
left a comment
There was a problem hiding this comment.
Changes look good, but note that you have a merge conflict to fix
use-parameter-descriptions|
Anthony Martin (@anthony-c-martin) Implemented 5 new linter rules to enforce descriptions. As requested by Stanislav Zhelyazkov (@slavizh) a type decorated with CleanShot.2026-08-07.at.12.57.52.mp4Xelu86 For the documentation the names will be like this: |
|
The only problem I am seeing is when you right-click on the type property (for example
|
I think this is fine to address separtely |
|
John (@johnlokerse) - could we rename the linter rules for parity with the These would be the updated names: |
Done! Xelu86 The linter rules are renamed to what Anthony mentioned |



Description
This change adds a new Bicep linter rule called
use-parameter-descriptions. Default the rule level isoffbut when set toerrorit checks if the parameter has either the@sys.descriptionor@descriptiondecorator above a parameter. Additionally, it checks if the description is not empty.Anthony Martin (@anthony-c-martin) stephaniezyen This implements issue #9453 and #5595.
Example Usage
It works through the
bicep lintercommand or using the VSCode extension:Checklist
Microsoft Reviewers: Open in CodeFlow