Muokkaa

Jaa


Linter rule - decompiler cleanup

The Bicep CLI decompile command converts ARM template JSON to a Bicep file. If a variable name, or a parameter name, or a resource symbolic name is ambiguous, the Bicep CLI adds a suffix to the name, for example accountName_var or virtualNetwork_resource. This rule finds these names in Bicep files.

Linter rule code

Use the following value in the Bicep configuration file to customize rule settings:

decompiler-cleanup

Solution

To increase the readability, update these names with more meaningful names.

The following example fails this test because the two variable names appear to have originated from a naming conflict during a decompilation from JSON.

var hostingPlanName_var = functionAppName
var storageAccountName_var = 'azfunctions${uniqueString(resourceGroup().id)}'

This example passes this test.

var hostingPlanName = functionAppName
var storageAccountName = 'azfunctions${uniqueString(resourceGroup().id)}'

Consider using F2 in Visual Studio Code to replace symbols.

Next steps

For more information about the linter, see Use Bicep linter.