bump version. fix a nil panic issue. add doc test
This commit is contained in:
Родитель
1983382f4a
Коммит
91f0f60535
|
@ -27,3 +27,6 @@ jobs:
|
|||
run: make build
|
||||
- name: Run tests
|
||||
run: make test
|
||||
- name: Doc test
|
||||
run: |
|
||||
sh script/check_doc.sh
|
|
@ -3,7 +3,6 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"golang.org/x/oauth2"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
@ -12,6 +11,7 @@ import (
|
|||
|
||||
"github.com/google/go-github/v47/github"
|
||||
"github.com/hashicorp/go-getter/v2"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -44,7 +44,7 @@ func goModEnsure() {
|
|||
func prepareTerraformAzurermProviderCode(latest string) {
|
||||
link := fmt.Sprintf("https://github.com/hashicorp/terraform-provider-azurerm/archive/refs/tags/%s.zip", latest)
|
||||
fmt.Printf("Getting %s\n", link)
|
||||
_, err := getter.Get(context.TODO(), "./", link)
|
||||
_, err := getter.Get(context.Background(), "./", link)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
|
5
main.go
5
main.go
|
@ -12,10 +12,7 @@ func main() {
|
|||
RuleSet: &tflint.BuiltinRuleSet{
|
||||
Name: "azurerm-ext",
|
||||
Version: project.Version,
|
||||
Rules: []tflint.Rule{
|
||||
rules.NewAzurermArgOrderRule(),
|
||||
rules.NewAzurermResourceTagRule(),
|
||||
},
|
||||
Rules: rules.Rules,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package project
|
|||
import "fmt"
|
||||
|
||||
// Version is ruleset version
|
||||
const Version string = "0.0.4"
|
||||
const Version string = "0.0.5"
|
||||
|
||||
// ReferenceLink returns the rule reference link
|
||||
func ReferenceLink(name string) string {
|
||||
|
|
|
@ -51,6 +51,9 @@ func (r *AzurermArgOrderRule) CheckFile(runner tflint.Runner, file *hcl.File) er
|
|||
var subErr error
|
||||
rootBlockType := provider.RootBlockType(block.Type)
|
||||
_, typeWanted := provider.RootBlockTypes[rootBlockType]
|
||||
if !typeWanted {
|
||||
continue
|
||||
}
|
||||
isAzBlock := provider.GetArgSchema([]string{block.Type, block.Labels[0]}) != nil
|
||||
if typeWanted && isAzBlock {
|
||||
subErr = r.visitAzBlock(runner, block)
|
||||
|
|
|
@ -640,6 +640,12 @@ resource "azurerm_container_group" "example" {
|
|||
}`,
|
||||
Expected: helper.Issues{},
|
||||
},
|
||||
{
|
||||
Name: "non-wanted type block",
|
||||
Content: `
|
||||
locals{}`,
|
||||
Expected: helper.Issues{},
|
||||
},
|
||||
}
|
||||
|
||||
rule := NewAzurermArgOrderRule()
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/terraform-linters/tflint-ruleset-azurerm-ext/rules"
|
||||
"sort"
|
||||
)
|
||||
|
||||
func main() {
|
||||
sort.Slice(rules.Rules, func(i, j int) bool {
|
||||
return rules.Rules[i].Name() < rules.Rules[j].Name()
|
||||
})
|
||||
for _, rule := range rules.Rules {
|
||||
fmt.Printf("%s.md\n", rule.Name())
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package rules
|
||||
|
||||
import "github.com/terraform-linters/tflint-plugin-sdk/tflint"
|
||||
|
||||
var Rules = []tflint.Rule{
|
||||
NewAzurermArgOrderRule(),
|
||||
NewAzurermResourceTagRule(),
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
ls -1 docs/rules | sort -n > expected
|
||||
go run rules/rule_names/main.go > actual
|
||||
|
||||
diff expected actual
|
Загрузка…
Ссылка в новой задаче