Showing 195 of 515 total issues
Method ServiceScanReconciler.SetupWithManager
has 6 return statements (exceeds 4 allowed). Open
func (r *ServiceScanReconciler) SetupWithManager(mgr ctrl.Manager) error {
// Check if scan names are unique
if err := util.CheckUniquenessOfScanNames(r.Config.ContainerAutoDiscoveryConfig.ScanConfigs); err != nil {
r.Log.Error(err, "Scan names are not unique")
return err
Function uploadFile
has 6 return statements (exceeds 4 allowed). Open
func uploadFile(path, url string) error {
file, err := os.Open(path)
if err != nil {
log.Printf("Failed to open file: %v", err)
return err
Method ContainerScanReconciler.createScheduledScanWithImagePullSecrets
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (r *ContainerScanReconciler) createScheduledScanWithImagePullSecrets(ctx context.Context, pod corev1.Pod, imageID string, scanConfig configv1.ScanConfig, secrets []corev1.LocalObjectReference) {
Function keepWaitingForMainContainerToExit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func keepWaitingForMainContainerToExit(context context.Context, container string, podName string, namespace string, clientset *kubernetes.Clientset) bool {
Method ContainerScanReconciler.generateScanWithVolumeMounts
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (r *ContainerScanReconciler) generateScanWithVolumeMounts(pod corev1.Pod, imageID string, scanConfig configv1.ScanConfig, namespace corev1.Namespace, secrets []corev1.LocalObjectReference) executionv1.ScheduledScan {
Function getCascadingScans
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
parentScan: Scan,
findings: Array<Finding>,
cascadingRules: Array<CascadingRule>,
cascadedRuleUsedForParentScan: CascadingRule,
parseDefinition: ParseDefinition
Function __configure_proxy_authentication
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __configure_proxy_authentication(self, proxy_config: collections.OrderedDict):
"""Private method to configure the proxy authenication, based on the configuration settings."""
# Configure ZAP outgoing proxy server authentication
if "authentication" in proxy_config and (
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getNextSchedule
has 5 return statements (exceeds 4 allowed). Open
func getNextSchedule(r *ScheduledScanReconciler, scheduledScan executionv1.ScheduledScan, now time.Time) (next time.Time, err error) {
// check if the Cron schedule is set
if scheduledScan.Spec.Schedule != "" {
sched, err := cron.ParseStandard(scheduledScan.Spec.Schedule)
if err != nil {
Method ContainerScanReconciler.Reconcile
has 5 return statements (exceeds 4 allowed). Open
func (r *ContainerScanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := r.Log
log.V(8).Info("Something happened to a pod", "pod", req.Name, "namespace", req.Namespace)
Method ScanReconciler.SetupWithManager
has 5 return statements (exceeds 4 allowed). Open
func (r *ScanReconciler) SetupWithManager(mgr ctrl.Manager) error {
r.MinioClient = *r.initS3Connection()
// Todo: Better config management
Method ScanReconciler.setHookStatus
has 5 return statements (exceeds 4 allowed). Open
func (r *ScanReconciler) setHookStatus(scan *executionv1.Scan) error {
// Set (pending) Hook status on the scan
ctx := context.Background()
labelSelector, err := r.getLabelSelector(scan)
if err != nil {
Method equals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ScheduledScanReconciler.SetupWithManager
has 5 return statements (exceeds 4 allowed). Open
func (r *ScheduledScanReconciler) SetupWithManager(mgr ctrl.Manager) error {
// set up a real clock, since we're not in a test
ctx := context.Background()
if err := mgr.GetFieldIndexer().IndexField(ctx, &executionv1.Scan{}, ownerKey, func(rawObj client.Object) []string {
// grab the job object, extract the owner...
Function parse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function parse(fileContent) {
// The first scan always contains the image id a similar format to: "bkimminich/juice-shop:v10.2.0 (alpine 3.11.5)"
let scanResults = fileContent;
if (typeof fileContent === "string") {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ScanReconciler.Reconcile
has 5 return statements (exceeds 4 allowed). Open
func (r *ScanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := r.Log.WithValues("scan", req.NamespacedName)
// get the scan
var scan executionv1.Scan
Method equals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method equals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return ["Outdated Software", MEDIUM];
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return createAutomountedServiceAccountTokenFinding(finding);