File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ package cmd
77import (
88 "fmt"
99 "io"
10+ "io/fs"
1011 "os"
1112
1213 "github.com/spf13/cobra"
@@ -87,6 +88,7 @@ func checkModules(params checkParams, args []string) error {
8788 WithSkipBundleVerification (true ).
8889 WithProcessAnnotation (true ).
8990 WithCapabilities (capabilities ).
91+ WithFilter (filterFromPaths (params .ignore )).
9092 AsBundle (path )
9193 if err != nil {
9294 return err
@@ -130,6 +132,12 @@ func checkModules(params checkParams, args []string) error {
130132 return nil
131133}
132134
135+ func filterFromPaths (paths []string ) loader.Filter {
136+ return func (abspath string , info fs.FileInfo , depth int ) bool {
137+ return loaderFilter {Ignore : paths }.Apply (abspath , info , depth )
138+ }
139+ }
140+
133141func outputErrors (format string , err error ) {
134142 var out io.Writer
135143 if err != nil {
Original file line number Diff line number Diff line change @@ -188,6 +188,27 @@ func TestCheckIgnoresNonRegoFiles(t *testing.T) {
188188 })
189189}
190190
191+ func TestCheckIgnoreBundleMode (t * testing.T ) {
192+ t .Parallel ()
193+
194+ files := map [string ]string {
195+ "ignore.rego" : `invalid rego` ,
196+ "include.rego" : `package valid` ,
197+ }
198+
199+ test .WithTempFS (files , func (root string ) {
200+ params := newCheckParams ()
201+
202+ params .ignore = []string {"ignore.rego" }
203+ params .bundleMode = true
204+
205+ err := checkModules (params , []string {root })
206+ if err != nil {
207+ t .Fatalf ("unexpected error: %v" , err )
208+ }
209+ })
210+ }
211+
191212func TestCheckFailsOnInvalidRego (t * testing.T ) {
192213 files := map [string ]string {
193214 "test.rego" : `package test
You can’t perform that action at this time.
0 commit comments