Skip to content

Commit

Permalink
chore: remove gojsonschema
Browse files Browse the repository at this point in the history
  • Loading branch information
pgimalac committed Feb 24, 2025
1 parent 224e197 commit dc2b650
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 116 deletions.
87 changes: 0 additions & 87 deletions pkg/flag/misconf_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,6 @@ var (
}
)

// MisconfFlagGroup composes common printer flag structs used for commands providing misconfiguration scanning.
type MisconfFlagGroup struct {
IncludeNonFailures *Flag[bool]
ResetChecksBundle *Flag[bool]
ChecksBundleRepository *Flag[string]

// Values Files
HelmValues *Flag[[]string]
HelmValueFiles *Flag[[]string]
HelmFileValues *Flag[[]string]
HelmStringValues *Flag[[]string]
HelmAPIVersions *Flag[[]string]
HelmKubeVersion *Flag[string]
TerraformTFVars *Flag[[]string]
CloudformationParamVars *Flag[[]string]
TerraformExcludeDownloaded *Flag[bool]
MisconfigScanners *Flag[[]string]
ConfigFileSchemas *Flag[[]string]
}

type MisconfOptions struct {
IncludeNonFailures bool
ResetChecksBundle bool
Expand All @@ -146,71 +126,4 @@ type MisconfOptions struct {
CloudFormationParamVars []string
TfExcludeDownloaded bool
MisconfigScanners []analyzer.Type
ConfigFileSchemas []string
}

func NewMisconfFlagGroup() *MisconfFlagGroup {
return &MisconfFlagGroup{
IncludeNonFailures: IncludeNonFailuresFlag.Clone(),
ResetChecksBundle: ResetChecksBundleFlag.Clone(),
ChecksBundleRepository: ChecksBundleRepositoryFlag.Clone(),

HelmValues: HelmSetFlag.Clone(),
HelmFileValues: HelmSetFileFlag.Clone(),
HelmStringValues: HelmSetStringFlag.Clone(),
HelmValueFiles: HelmValuesFileFlag.Clone(),
HelmAPIVersions: HelmAPIVersionsFlag.Clone(),
HelmKubeVersion: HelmKubeVersionFlag.Clone(),
TerraformTFVars: TfVarsFlag.Clone(),
CloudformationParamVars: CfParamsFlag.Clone(),
TerraformExcludeDownloaded: TerraformExcludeDownloaded.Clone(),
MisconfigScanners: MisconfigScannersFlag.Clone(),
ConfigFileSchemas: ConfigFileSchemasFlag.Clone(),
}
}

func (f *MisconfFlagGroup) Name() string {
return "Misconfiguration"
}

func (f *MisconfFlagGroup) Flags() []Flagger {
return []Flagger{
f.IncludeNonFailures,
f.ResetChecksBundle,
f.ChecksBundleRepository,
f.HelmValues,
f.HelmValueFiles,
f.HelmFileValues,
f.HelmStringValues,
f.HelmAPIVersions,
f.HelmKubeVersion,
f.TerraformTFVars,
f.TerraformExcludeDownloaded,
f.CloudformationParamVars,
f.MisconfigScanners,
f.ConfigFileSchemas,
}
}

func (f *MisconfFlagGroup) ToOptions() (MisconfOptions, error) {
if err := parseFlags(f); err != nil {
return MisconfOptions{}, err
}

return MisconfOptions{
IncludeNonFailures: f.IncludeNonFailures.Value(),
ResetChecksBundle: f.ResetChecksBundle.Value(),
ChecksBundleRepository: f.ChecksBundleRepository.Value(),
HelmValues: f.HelmValues.Value(),
HelmValueFiles: f.HelmValueFiles.Value(),
HelmFileValues: f.HelmFileValues.Value(),
HelmStringValues: f.HelmStringValues.Value(),
HelmAPIVersions: f.HelmAPIVersions.Value(),
HelmKubeVersion: f.HelmKubeVersion.Value(),
TerraformTFVars: f.TerraformTFVars.Value(),
CloudFormationParamVars: f.CloudformationParamVars.Value(),
TfExcludeDownloaded: f.TerraformExcludeDownloaded.Value(),
MisconfigScanners: xstrings.ToTSlice[analyzer.Type](f.MisconfigScanners.Value()),
ConfigFileSchemas: f.ConfigFileSchemas.Value(),
}, nil
}
11 changes: 0 additions & 11 deletions pkg/flag/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ type Flags struct {
ImageFlagGroup *ImageFlagGroup
K8sFlagGroup *K8sFlagGroup
LicenseFlagGroup *LicenseFlagGroup
MisconfFlagGroup *MisconfFlagGroup
ModuleFlagGroup *ModuleFlagGroup
PackageFlagGroup *PackageFlagGroup
RemoteFlagGroup *RemoteFlagGroup
Expand Down Expand Up @@ -562,9 +561,6 @@ func (f *Flags) groups() []FlagGroup {
if f.ImageFlagGroup != nil {
groups = append(groups, f.ImageFlagGroup)
}
if f.MisconfFlagGroup != nil {
groups = append(groups, f.MisconfFlagGroup)
}
if f.ModuleFlagGroup != nil {
groups = append(groups, f.ModuleFlagGroup)
}
Expand Down Expand Up @@ -711,13 +707,6 @@ func (f *Flags) ToOptions(args []string) (Options, error) {
}
}

if f.MisconfFlagGroup != nil {
opts.MisconfOptions, err = f.MisconfFlagGroup.ToOptions()
if err != nil {
return Options{}, xerrors.Errorf("misconfiguration flag error: %w", err)
}
}

if f.ModuleFlagGroup != nil {
opts.ModuleOptions, err = f.ModuleFlagGroup.ToOptions()
if err != nil {
Expand Down
17 changes: 0 additions & 17 deletions pkg/misconf/config_schema.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/misconf/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ type ScannerOption struct {
K8sVersion string

FilePatterns []string
ConfigFileSchemas []*ConfigFileSchema

DisabledCheckIDs []string
SkipFiles []string
Expand Down

0 comments on commit dc2b650

Please sign in to comment.