Showing 195 of 515 total issues
Method ScanReconciler.startParser
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. 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)
- 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 purgeCascadedRuleFromScan
has a Cognitive Complexity of 13 (exceeds 5 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.
- 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 _configure_load_script
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _configure_load_script(
self, script_config: collections.OrderedDict, script_type: str
):
"""Protected method to load a new ZAP Script based on a given ZAP config.
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parse(fileContent) {
// Only 0 when the target wasn't reachable
if (!fileContent.server_scan_results || fileContent.server_scan_results.length === 0) {
return [];
}
Function parseImageScanResults
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseImageScanResults(imageScanResults) {
// check if imageScanResults.Results is an array and non empty
if (!Array.isArray(imageScanResults.Results) || imageScanResults.Results.length === 0) {
return [];
}
Function main
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
var configFile string
flag.StringVar(&configFile, "config", "",
"The controller will load its initial configuration from this file. "+
"Omit this flag to use the default configuration values. "+
Function _create_finding
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_finding(
Function transformToFindings
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function transformToFindings(ncrackrun, publicKey) {
return ncrackrun.service.flatMap(({address, port, credentials = []}) => {
const {addr: ipAddress} = address[0]["$"];
const {protocol, portid, name: portName} = port[0]["$"];
Function main
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function main() {
const currentDirectory = __dirname; // current directory is /documentation/src
const parentDirectory = path.dirname(currentDirectory); // parent is /documentation
const rootDirectory = path.dirname(parentDirectory); // root is /
Function getValidFindings
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getValidFindings(){
return [{
name: "Test read-write-hook service",
description: `Port is using protocol.`,
category: "Open Port",
Function getScansMatchingRule
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getScansMatchingRule(
parentScan: Scan,
findings: Array<Finding>,
cascadingRule: CascadingRule,
parseDefinition: ParseDefinition
Method ScanReconciler.startScan
has 15 return statements (exceeds 4 allowed). Open
func (r *ScanReconciler) startScan(scan *executionv1.Scan) error {
ctx := context.Background()
namespacedName := fmt.Sprintf("%s/%s", scan.Namespace, scan.Name)
log := r.Log.WithValues("scan_init", namespacedName)
Method equals
has a Cognitive Complexity of 12 (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 analyseCertificateDeployments
has a Cognitive Complexity of 12 (exceeds 5 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
);
- 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 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function parse (fileContent, scan) {
if (fileContent) {
const commitUrlBase = prepareCommitUrl(scan);
Consider simplifying this complex logical expression. Open
if(script.table && script.table[0] && script.table[0].elem) {
for(const elem of script.table[0].elem) {
console.log ("Found SMB SMB Protocol: " + elem);
//console.log (elem);
Method ScheduledScanReconciler.Reconcile
has 14 return statements (exceeds 4 allowed). Open
func (r *ScheduledScanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := r.Log.WithValues("scheduledscan", req.NamespacedName)
// get the ScheduledScan
var scheduledScan executionv1.ScheduledScan
Method ParseDefinitionSpec.DeepCopyInto
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (in *ParseDefinitionSpec) DeepCopyInto(out *ParseDefinitionSpec) {
*out = *in
if in.ScopeLimiterAliases != nil {
in, out := &in.ScopeLimiterAliases, &out.ScopeLimiterAliases
*out = make(map[string]string, len(*in))
Method ScanReconciler.startScan
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (r *ScanReconciler) startScan(scan *executionv1.Scan) error {
ctx := context.Background()
namespacedName := fmt.Sprintf("%s/%s", scan.Namespace, scan.Name)
log := r.Log.WithValues("scan_init", namespacedName)
- 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 convertTrivyK8sFindingToSCBFinding
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function convertTrivyK8sFindingToSCBFinding(trivyK8sFinding, clusterName, namespace, kind, k8sName, target, clazz, type, categoryName) {
let references = trivyK8sFinding.PrimaryURL ? [{type: "URL", value: trivyK8sFinding.PrimaryURL}] : [];
const url_references = getUrlReferences(trivyK8sFinding.References).filter(ref => ref.value !== trivyK8sFinding.PrimaryURL);
references = references.concat(url_references);
- 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"