Showing 202 of 524 total issues
File hook.test.js
has 2560 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
const {getCascadingScans} = require("./hook");
File parser.test.js
has 1226 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
const { readFile } = require("fs/promises");
File scope-limiter.test.js
has 942 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
const {isInScope: isInScopeInternal} = require("./scope-limiter");
File parser.test.js
has 872 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
const fs = require("fs");
File parser.test.js
has 722 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
const { readFile } = require("fs/promises");
File zz_generated.deepcopy.go
has 844 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// SPDX-FileCopyrightText: the secureCodeBox authors
//
File parser.test.js
has 570 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
const { readFile } = require("fs/promises");
Method ScanReconciler.startParser
has 205 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r *ScanReconciler) startParser(scan *executionv1.Scan) error {
ctx := context.Background()
namespacedName := fmt.Sprintf("%s/%s", scan.Namespace, scan.Name)
log := r.Log.WithValues("scan_parse", namespacedName)
Method ScanReconciler.constructJobForScan
has 189 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanTypeSpec *executionv1.ScanTypeSpec) (*batch.Job, error) {
filename := filepath.Base(scanTypeSpec.ExtractResults.Location)
urlExpirationDuration, err := util.GetUrlExpirationDuration(util.ScanController)
if err != nil {
r.Log.Error(err, "Failed to parse scan url expiration")
Function HomePage
has 145 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function HomePage() {
const { isDarkTheme } = useColorMode();
return (
<>
V1ScanStatus
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
Open
@ApiModel(description = "ScanStatus defines the observed state of Scan")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2021-11-17T10:13:00.848Z[Etc/UTC]")
public class V1ScanStatus {
public static final String SERIALIZED_NAME_ERROR_DESCRIPTION = "errorDescription";
@SerializedName(SERIALIZED_NAME_ERROR_DESCRIPTION)
File parser.test.js
has 402 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
const { readFile } = require("fs/promises");
Function isInScope
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
Open
export function isInScope(
scopeLimiter: ScopeLimiter,
scanAnnotations: V1ObjectMeta["annotations"],
finding: Finding,
scopeLimiterAliases: ScopeLimiterAliases
- 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
File hook.test.js
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
const { handle } = require("./hook")
File hook.ts
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
import {
Function isInScope
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function isInScope(
scopeLimiter: ScopeLimiter,
scanAnnotations: V1ObjectMeta["annotations"],
finding: Finding,
scopeLimiterAliases: ScopeLimiterAliases
Method ScanReconciler.createJobForHook
has 143 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r *ScanReconciler) createJobForHook(hookName string, hookSpec *executionv1.ScanCompletionHookSpec, scan *executionv1.Scan, cliArgs []string) (string, error) {
ctx := context.Background()
serviceAccountName := "scan-completion-hook"
if hookSpec.ServiceAccountName != nil {
Method ServiceScanReconciler.Reconcile
has 140 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r *ServiceScanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := r.Log
log.V(8).Info("Something happened to a service", "service", req.Name, "namespace", req.Namespace)
Method ServiceScanReconciler.Reconcile
has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring. Open
Open
func (r *ServiceScanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := r.Log
log.V(8).Info("Something happened to a service", "service", req.Name, "namespace", req.Namespace)
- 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
File zap_context.py
has 341 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
#!/usr/bin/env python
# SPDX-FileCopyrightText: the secureCodeBox authors
#
# SPDX-License-Identifier: Apache-2.0