mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 18:09:55 +00:00
simplified trivial expressions (gosimple)
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
This commit is contained in:
@@ -32,7 +32,7 @@ func NewWorkerPool() workerPool {
|
||||
}
|
||||
|
||||
func (wp *workerPool) init(noOfPods ...int) {
|
||||
if noOfPods != nil && len(noOfPods) > 0 && noOfPods[0] < noOfWorkers {
|
||||
if len(noOfPods) > 0 && noOfPods[0] < noOfWorkers {
|
||||
wp.noOfWorkers = noOfPods[0]
|
||||
}
|
||||
// init the channels
|
||||
|
||||
@@ -34,10 +34,7 @@ func NewExcludeSelector(ns string) *ExcludeSelector {
|
||||
|
||||
func (es *ExcludeSelector) GetClusterScope(resource *schema.GroupVersionResource) bool {
|
||||
// for selector, 'namespace' is in Namespaced scope
|
||||
if resource.Resource == "namespaces" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return resource.Resource == "namespaces"
|
||||
}
|
||||
|
||||
type IncludeSelector struct {
|
||||
@@ -50,10 +47,7 @@ func NewIncludeSelector(ns string) *IncludeSelector {
|
||||
|
||||
func (is *IncludeSelector) GetClusterScope(resource *schema.GroupVersionResource) bool {
|
||||
// for selector, 'namespace' is in Namespaced scope
|
||||
if resource.Resource == "namespaces" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return resource.Resource == "namespaces"
|
||||
}
|
||||
|
||||
func (es *ExcludeSelector) GetNamespacesSelectors(resource *schema.GroupVersionResource) []string {
|
||||
|
||||
@@ -26,11 +26,7 @@ func isGitRepoPublic(u string) bool {
|
||||
|
||||
// if the status code is 200, our get request is successful.
|
||||
// It only happens when the repository is public.
|
||||
if resp.StatusCode == 200 {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return resp.StatusCode == nethttp.StatusOK
|
||||
}
|
||||
|
||||
// Check if the GITHUB_TOKEN is present
|
||||
|
||||
@@ -87,7 +87,7 @@ func getNumericValueFromEnvVar(envVar string, defaultValue int) int {
|
||||
return defaultValue
|
||||
}
|
||||
func (prettyPrinter *PrettyPrinter) printAttackTracks(opaSessionObj *cautils.OPASessionObj) {
|
||||
if prettyPrinter.printAttackTree == false || opaSessionObj.ResourceAttackTracks == nil {
|
||||
if !prettyPrinter.printAttackTree || opaSessionObj.ResourceAttackTracks == nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,6 @@ func (hp *HtmlPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj) {
|
||||
}
|
||||
|
||||
func (hp *HtmlPrinter) Score(score float32) {
|
||||
return
|
||||
}
|
||||
|
||||
func buildResourceTableView(opaSessionObj *cautils.OPASessionObj) ResourceTableView {
|
||||
|
||||
@@ -62,7 +62,6 @@ func NewSARIFPrinter() *SARIFPrinter {
|
||||
}
|
||||
|
||||
func (sp *SARIFPrinter) Score(score float32) {
|
||||
return
|
||||
}
|
||||
|
||||
func (sp *SARIFPrinter) SetWriter(outputFile string) {
|
||||
|
||||
Reference in New Issue
Block a user