secureCodeBox/secureCodeBox

View on GitHub
scanners/sslyze/parser/parser.test.js

Summary

Maintainability
F
5 days
Test Coverage

File parser.test.js has 722 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0

const { readFile } = require("fs/promises");
Severity: Major
Found in scanners/sslyze/parser/parser.test.js - About 1 day to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    test("parses result file for tls-v1-0.badssl.com:1010 correctly", async () => {
      const fileContent = JSON.parse(
        await readFile(__dirname + "/__testFiles__/tls-v1-0.badssl.com_1010.json", {
          encoding: "utf8",
        })
    Severity: Major
    Found in scanners/sslyze/parser/parser.test.js and 1 other location - About 4 hrs to fix
    scanners/sslyze/parser/parser.test.js on lines 12..64

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 121.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    test("parses result file for www.securecodebox.io correctly", async () => {
      const fileContent = JSON.parse(
        await readFile(__dirname + "/__testFiles__/www.securecodebox.io.json", {
          encoding: "utf8",
        })
    Severity: Major
    Found in scanners/sslyze/parser/parser.test.js and 1 other location - About 4 hrs to fix
    scanners/sslyze/parser/parser.test.js on lines 66..169

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 121.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 16 locations. Consider refactoring.
    Open

    test("parses result file for self-signed.badssl.com correctly", async () => {
      const fileContent = JSON.parse(
        await readFile(__dirname + "/__testFiles__/self-signed.badssl.com.json", {
          encoding: "utf8",
        })
    Severity: Major
    Found in scanners/sslyze/parser/parser.test.js and 15 other locations - About 3 hrs to fix
    scanners/nikto/parser/parser.test.js on lines 34..43
    scanners/ssh-audit/parser/parser.test.js on lines 15..345
    scanners/ssh-audit/parser/parser.test.js on lines 359..654
    scanners/ssh-audit/parser/parser.test.js on lines 656..882
    scanners/ssh-scan/parser/parser.test.js on lines 23..138
    scanners/ssh-scan/parser/parser.test.js on lines 140..275
    scanners/ssh-scan/parser/parser.test.js on lines 277..286
    scanners/sslyze/parser/parser.test.js on lines 171..291
    scanners/sslyze/parser/parser.test.js on lines 293..412
    scanners/sslyze/parser/parser.test.js on lines 414..536
    scanners/sslyze/parser/parser.test.js on lines 659..729
    scanners/trivy/parser/parser.test.js on lines 46..56
    scanners/trivy/parser/parser.test.js on lines 92..101
    scanners/wpscan/parser/parser.test.js on lines 12..188
    scanners/wpscan/parser/parser.test.js on lines 190..329

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 102.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 16 locations. Consider refactoring.
    Open

    test("parses result file for untrusted-root.badssl.com correctly", async () => {
      const fileContent = JSON.parse(
        await readFile(
          __dirname + "/__testFiles__/untrusted-root.badssl.com.json",
          {
    Severity: Major
    Found in scanners/sslyze/parser/parser.test.js and 15 other locations - About 3 hrs to fix
    scanners/nikto/parser/parser.test.js on lines 34..43
    scanners/ssh-audit/parser/parser.test.js on lines 15..345
    scanners/ssh-audit/parser/parser.test.js on lines 359..654
    scanners/ssh-audit/parser/parser.test.js on lines 656..882
    scanners/ssh-scan/parser/parser.test.js on lines 23..138
    scanners/ssh-scan/parser/parser.test.js on lines 140..275
    scanners/ssh-scan/parser/parser.test.js on lines 277..286
    scanners/sslyze/parser/parser.test.js on lines 171..291
    scanners/sslyze/parser/parser.test.js on lines 293..412
    scanners/sslyze/parser/parser.test.js on lines 538..657
    scanners/sslyze/parser/parser.test.js on lines 659..729
    scanners/trivy/parser/parser.test.js on lines 46..56
    scanners/trivy/parser/parser.test.js on lines 92..101
    scanners/wpscan/parser/parser.test.js on lines 12..188
    scanners/wpscan/parser/parser.test.js on lines 190..329

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 102.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 16 locations. Consider refactoring.
    Open

    test("parses result file for target without certificate_deployments correctly", async () => {
      const fileContent = JSON.parse(
        await readFile(
          __dirname + "/__testFiles__/no-certificate_deployments.json",
          {
    Severity: Major
    Found in scanners/sslyze/parser/parser.test.js and 15 other locations - About 3 hrs to fix
    scanners/nikto/parser/parser.test.js on lines 34..43
    scanners/ssh-audit/parser/parser.test.js on lines 15..345
    scanners/ssh-audit/parser/parser.test.js on lines 359..654
    scanners/ssh-audit/parser/parser.test.js on lines 656..882
    scanners/ssh-scan/parser/parser.test.js on lines 23..138
    scanners/ssh-scan/parser/parser.test.js on lines 140..275
    scanners/ssh-scan/parser/parser.test.js on lines 277..286
    scanners/sslyze/parser/parser.test.js on lines 171..291
    scanners/sslyze/parser/parser.test.js on lines 293..412
    scanners/sslyze/parser/parser.test.js on lines 414..536
    scanners/sslyze/parser/parser.test.js on lines 538..657
    scanners/trivy/parser/parser.test.js on lines 46..56
    scanners/trivy/parser/parser.test.js on lines 92..101
    scanners/wpscan/parser/parser.test.js on lines 12..188
    scanners/wpscan/parser/parser.test.js on lines 190..329

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 102.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 16 locations. Consider refactoring.
    Open

    test("parses result file for wrong.host.badssl.com correctly", async () => {
      const fileContent = JSON.parse(
        await readFile(__dirname + "/__testFiles__/wrong.host.badssl.com.json", {
          encoding: "utf8",
        })
    Severity: Major
    Found in scanners/sslyze/parser/parser.test.js and 15 other locations - About 3 hrs to fix
    scanners/nikto/parser/parser.test.js on lines 34..43
    scanners/ssh-audit/parser/parser.test.js on lines 15..345
    scanners/ssh-audit/parser/parser.test.js on lines 359..654
    scanners/ssh-audit/parser/parser.test.js on lines 656..882
    scanners/ssh-scan/parser/parser.test.js on lines 23..138
    scanners/ssh-scan/parser/parser.test.js on lines 140..275
    scanners/ssh-scan/parser/parser.test.js on lines 277..286
    scanners/sslyze/parser/parser.test.js on lines 171..291
    scanners/sslyze/parser/parser.test.js on lines 414..536
    scanners/sslyze/parser/parser.test.js on lines 538..657
    scanners/sslyze/parser/parser.test.js on lines 659..729
    scanners/trivy/parser/parser.test.js on lines 46..56
    scanners/trivy/parser/parser.test.js on lines 92..101
    scanners/wpscan/parser/parser.test.js on lines 12..188
    scanners/wpscan/parser/parser.test.js on lines 190..329

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 102.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 16 locations. Consider refactoring.
    Open

    test("parses result file for expired.badssl.com correctly", async () => {
      const fileContent = JSON.parse(
        await readFile(__dirname + "/__testFiles__/expired.badssl.com.json", {
          encoding: "utf8",
        })
    Severity: Major
    Found in scanners/sslyze/parser/parser.test.js and 15 other locations - About 3 hrs to fix
    scanners/nikto/parser/parser.test.js on lines 34..43
    scanners/ssh-audit/parser/parser.test.js on lines 15..345
    scanners/ssh-audit/parser/parser.test.js on lines 359..654
    scanners/ssh-audit/parser/parser.test.js on lines 656..882
    scanners/ssh-scan/parser/parser.test.js on lines 23..138
    scanners/ssh-scan/parser/parser.test.js on lines 140..275
    scanners/ssh-scan/parser/parser.test.js on lines 277..286
    scanners/sslyze/parser/parser.test.js on lines 293..412
    scanners/sslyze/parser/parser.test.js on lines 414..536
    scanners/sslyze/parser/parser.test.js on lines 538..657
    scanners/sslyze/parser/parser.test.js on lines 659..729
    scanners/trivy/parser/parser.test.js on lines 46..56
    scanners/trivy/parser/parser.test.js on lines 92..101
    scanners/wpscan/parser/parser.test.js on lines 12..188
    scanners/wpscan/parser/parser.test.js on lines 190..329

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 102.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    test("parses an empty result file correctly", async () => {
      const fileContent = JSON.parse(
        await readFile(__dirname + "/__testFiles__/unavailable-host.json", {
          encoding: "utf8",
        })
    Severity: Major
    Found in scanners/sslyze/parser/parser.test.js and 1 other location - About 3 hrs to fix
    scanners/ssh-scan/parser/parser.test.js on lines 12..21

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 98.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 13 locations. Consider refactoring.
    Open

    test("should properly parse empty json file", async () => {
      const jsonContent = await readFile(
        __dirname + "/__testFiles__/test-empty-report.json",
        {
          encoding: "utf8",
    Severity: Major
    Found in scanners/sslyze/parser/parser.test.js and 12 other locations - About 2 hrs to fix
    scanners/cmseek/parser/parser.test.js on lines 55..65
    scanners/kube-hunter/parser/parser.test.js on lines 26..36
    scanners/kubeaudit/parser/parser.test.js on lines 25..35
    scanners/nmap/parser/parser.test.js on lines 143..169
    scanners/nmap/parser/parser.test.js on lines 171..179
    scanners/nmap/parser/parser.test.js on lines 181..235
    scanners/ssh-audit/parser/parser.test.js on lines 347..357
    scanners/ssh-scan/parser/parser.test.js on lines 288..298
    scanners/trivy/parser/parser.test.js on lines 103..113
    scanners/typo3scan/parser/parser.test.js on lines 40..50
    scanners/wpscan/parser/parser.test.js on lines 331..341
    scanners/zap/parser/parser.test.js on lines 51..62

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 94.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status