Skip to content

Commit

Permalink
updated sample plugin code
Browse files Browse the repository at this point in the history
  • Loading branch information
daveshanley committed Oct 21, 2024
1 parent 90836cc commit 1562583
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 63 deletions.
2 changes: 1 addition & 1 deletion plugin/sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ git clone https://github.com/daveshanley/vacuum.git && cd vacuum/plugin/sample
Once checked out, compile the plugin.

```bash
go build -buildmode=plugin .
go build -buildmode=plugin boot.go check_single_path.go useless_func.go
```
Go back up into the vacuum directory and compile vacuum

Expand Down
6 changes: 5 additions & 1 deletion plugin/sample/check_single_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"
"github.com/daveshanley/vacuum/model"
"gopkg.in/yaml.v3"
yaml "gopkg.in/yaml.v3"
)

// checkSinglePathExists is an example custom rule that checks only a single path exists.
Expand All @@ -17,6 +17,10 @@ func (s checkSinglePathExists) GetSchema() model.RuleFunctionSchema {
}
}

func (s checkSinglePathExists) GetCategory() string {
return "sample"
}

// RunRule will execute the Sample rule, based on supplied context and a supplied []*yaml.Node slice.
func (s checkSinglePathExists) RunRule(nodes []*yaml.Node, context model.RuleFunctionContext) []model.RuleFunctionResult {

Expand Down
40 changes: 19 additions & 21 deletions plugin/sample/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module sample

go 1.22
go 1.23.0

require (
github.com/daveshanley/vacuum v0.10.0
github.com/daveshanley/vacuum v0.14.1
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v3 v3.0.1
)
Expand All @@ -14,36 +14,34 @@ require (
atomicgo.dev/schedule v0.1.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/containerd/console v1.0.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2 // indirect
github.com/dop251/goja_nodejs v0.0.0-20240418154818-2aae10d4cbcf // indirect
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/dop251/goja v0.0.0-20241009100908-5f46f2705ca3 // indirect
github.com/dop251/goja_nodejs v0.0.0-20240728170619-29b559befffc // indirect
github.com/dprotaso/go-yit v0.0.0-20240618133044-5a0af90af097 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/google/pprof v0.0.0-20230926050212-f7f687d19a98 // indirect
github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pb33f/doctor v0.0.7 // indirect
github.com/pb33f/libopenapi v0.16.8 // indirect
github.com/pb33f/libopenapi-validator v0.0.56 // indirect
github.com/pb33f/doctor v0.0.14 // indirect
github.com/pb33f/libopenapi v0.18.4 // indirect
github.com/pb33f/libopenapi-validator v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/pterm/pterm v0.12.79 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.9-0.20240815153524-6ea36470d1bd // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.19.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit 1562583

Please sign in to comment.