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 075fdae
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 075fdae

Please sign in to comment.