Azure / Azure/bicep

Add bicep linter rule to suggest use of empty() vs null or ''

Open
#18,524 1 comment 0 reactions 0 assignees View on GitHub
enhancement Needs: Upvote
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Is your feature request related to a problem? Please describe.**
When writing bicep and having parameters with required and optional strings it would be nice for the linting to suggest the use of empty().

For example:

```
param a string = '' // or omit the default or pass null whatever

resource certificate 'Microsoft.ApiManagement/service/certificates@2024-05-01' existing = if ( a!= '') {
parent: apim
name: backendCertificateName
}
```

It would be nice if it gives a warning/error that the checks can be better done with empty() because it also fixed null or spaces in string compares. I could not find if this was possible in the documentation.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named in the issue. Start from the Bicep example and identify how linter rules and their tests are organized; done means the linter warns when string checks against null or '' should use empty().

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.