Showing 195 of 515 total issues
Method ScanReconciler.ensureServiceAccountExists
has 88 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (r *ScanReconciler) ensureServiceAccountExists(namespace, serviceAccountName, description string, policyRules []rbacv1.PolicyRule) error {
ctx := context.Background()
var serviceAccount corev1.ServiceAccount
err := r.Get(ctx, types.NamespacedName{Name: serviceAccountName, Namespace: namespace}, &serviceAccount)
Function mergeCascadingRuleWithScan
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mergeCascadingRuleWithScan(scan: Scan, cascadingRule: CascadingRule) {
const {scanAnnotations, scanLabels} = cascadingRule.spec;
let {
env = [],
volumes = [],
Function purgeCascadedRuleFromScan
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function purgeCascadedRuleFromScan(
scan: Scan,
cascadedRuleUsedForParentScan?: CascadingRule
): Scan {
// If there was no cascading rule applied to the parent scan, then ignore no purging is necessary.
Function getCascadingScan
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getCascadingScan(
parentScan: Scan,
finding: Finding,
cascadingRule: CascadingRule
) {
File scope-limiter.ts
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
import {Finding, ScopeLimiter, ScopeLimiterAliases} from "./scan-helpers";
File parser.js
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
const templates = {
Function start_spider
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def start_spider(self, url: str, spider_config: collections.OrderedDict):
"""Starts a ZAP Spider with the given spiders configuration, based on the internal referenced ZAP instance.
Parameters
----------
- 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 _get_active_config_from
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _get_active_config_from(self, configs: collections.OrderedDict, key: str):
"""Returns the active configuration by matching url or context
Parameters
----------
- 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 parse
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function parse(fileContent) {
const db = await openDatabase(fileContent);
const tableExists = await checkIfTableExists(db);
if (!tableExists) return [];
File docs.build.js
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
const fs = require("fs"),
Method ScanReconciler.processPendingHook
has 82 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (r *ScanReconciler) processPendingHook(scan *executionv1.Scan, status *executionv1.HookStatus, jobType string) error {
ctx := context.Background()
var err error
var hookName string
Function getPredicatesForEnabledPerNamespace
has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring. Open
func getPredicatesForEnabledPerNamespace(client client.Client, log logr.Logger) predicate.Predicate {
return predicate.Funcs{
CreateFunc: func(event event.CreateEvent) bool {
if val, ok := event.Object.GetAnnotations()["auto-discovery.securecodebox.io/ignore"]; ok && val == "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
Function analyseCertificateDeployments
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function analyseCertificateDeployments(serverScanResult) {
if (serverScanResult?.scan_result?.certificate_info?.result?.certificate_deployments) {
const certificateInfos = serverScanResult.scan_result.certificate_info.result.certificate_deployments.map(
analyseCertificateDeployment
);
File VersionedEngagementsStrategy.java
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
package io.securecodebox.persistence.strategies;
Function getExamples
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getExamples(dir) {
if (!fs.existsSync(dir)) {
return [];
}
File V1ScanStatus.java
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
/*
Function parse
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function parse(findings) {
let results = [];
Object.keys(findings).forEach((key) => {
const domain = key;
Method equals
has a Cognitive Complexity of 16 (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
Function parse
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function parse(fileContent) {
const hosts = fileContent;
if (typeof (hosts) === "string") // empty file
return [];
Function getTestData
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getTestData() {
const scan: Scan = {
metadata: {
uid: "09988cdf-1fc7-4f85-95ee-1b1d65dbc7cc",
name: "demo-scan-1601086432",