linter should catch non-optimal scope references
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
If you don't have a proper reference to a resource group (or other scope), you can provide a scope using the relevant scope function:
```bicep
module foo '...' = {
scope: resourceGroup('my-rg')
...
}
```
However, if you *do* have a reference, it is better to use that reference directly. This is a newer capability so there are old examples out there that use the previous way we exposed.
This is ideal if you have a reference:
```bicep
resource rg 'microsoft.resources/resourceGroups@2020-06-01' = { ... }
module foo '...' = {
scope: rg
...
}
```
But in practice we often see this less ideal pattern:
```bicep
resource rg 'microsoft.resources/resourceGroups@2020-06-01' = { ... }
module foo '...' = {
scope: resourceGroup(rg.name)
...
}
```
Contributor guide
Research direction
No source files, tests, or entry points are named. Start by locating the linter handling module scope expressions and compare the two Bicep examples; done means reporting the function-based form when a direct resource reference is available.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100