title | description | ms.topic | ms.custom | ms.date |
---|---|---|---|---|
Linter rule - prefer interpolation |
Linter rule - prefer interpolation |
conceptual |
devx-track-bicep |
03/20/2024 |
This rule finds uses of the concat function that can be replaced by string interpolation.
Use the following value in the Bicep configuration file to customize rule settings:
prefer-interpolation
Use string interpolation instead of the concat
function.
The following example fails this test because the concat
function is used.
param suffix string = '001'
var vnetName = concat('vnet-', suffix)
You can fix it by replacing concat
with string interpolation. The following example passes this test.
param suffix string = '001'
var vnetName = 'vnet-${suffix}'
Optionally, you can use Quickfix to replace the concat
with string interpolation:
:::image type="content" source="./media/linter-rule-prefer-interpolation/linter-rule-prefer-interpolation-quick-fix.png" alt-text="The screenshot of Prefer interpolation linter rule quick fix.":::
For more information about the linter, see Use Bicep linter.