secureCodeBox/secureCodeBox

View on GitHub

Showing 195 of 515 total issues

Method run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  @Override
  public List<Finding> run(Scan scan, ScanFile scanResultFile) throws DefectDojoPersistenceException {
    log.debug("Getting DefectDojo User Id via user profile API");
    final List<UserProfile> userProfiles;

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 9 (exceeds 5 allowed). Consider refactoring.
Open

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }

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 handle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

async function handle({
  getRawResults,
  scan,
  apiKey = process.env["DEPENDENCYTRACK_APIKEY"],
  baseUrl = process.env["DEPENDENCYTRACK_URL"],
Severity: Minor
Found in hooks/persistence-dependencytrack/hook/hook.js - About 55 mins to fix

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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in scanners/git-repo-scanner/scanner/git_repo_scanner/gitlab_scanner.py - About 50 mins to fix

    Method ScanReconciler.ensureServiceAccountExists has 8 return statements (exceeds 4 allowed).
    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)
    Severity: Major
    Found in operator/controllers/execution/scans/serviceaccount.go - About 50 mins to fix

      Method equals has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        @Override
        public boolean equals(Object o) {
          if (this == o) {
            return true;
          }

      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 deeply nested control flow statements.
      Open

                          if len(requests) > 0 {
                              for _, request := range requests {
                                  err = m.Reconciler.Reconcile(ctx, request)
                                  if err != nil {
                                      m.Log.Error(err, "Unable to reconcile request")
      Severity: Major
      Found in auto-discovery/cloud-aws/pkg/aws/aws.go - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if !errors {
                                // delete message from the service
                                // if there was a kubernetes error the message will be kept and tried again
                                // this might forever retry the same message or messages
                                m.deleteMessageFromQueue(ctx, message.ReceiptHandle)
        Severity: Major
        Found in auto-discovery/cloud-aws/pkg/aws/aws.go - About 45 mins to fix

          Function start_api_import has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def start_api_import(
                  self,
                  url: str,
                  context: collections.OrderedDict,
                  api_config: collections.OrderedDict,
          Severity: Minor
          Found in scanners/zap-advanced/scanner/zapclient/api/zap_api.py - About 45 mins to fix

          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 deeply nested control flow statements.
          Open

                              if err != nil {
                                  m.Log.Error(err, "Error handling AWS event")
                                  continue
                              }
          Severity: Major
          Found in auto-discovery/cloud-aws/pkg/aws/aws.go - About 45 mins to fix

            Function createDocFilesFromMainRepository has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            async function createDocFilesFromMainRepository(relPath, targetPath, dirNames) {
              for (const dirName of dirNames) {
                const readMe = `${relPath}/${dirName}/README.md`;
            
                if (!fs.existsSync(readMe)) {
            Severity: Minor
            Found in documentation/src/docs.build.js - About 45 mins to fix

            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 8 (exceeds 5 allowed). Consider refactoring.
            Open

              @Override
              public boolean equals(Object o) {
                if (this == o) {
                  return true;
                }

            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_report_template_for_file_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_report_template_for_file_type(self, file_type: str):
                    if file_type == "XML":
                        return "traditional-xml"
                    elif file_type == "XML-plus":
                        return "traditional-xml-plus"
            Severity: Minor
            Found in scanners/zap-advanced/scanner/zapclient/zap_automation.py - About 45 mins to fix

            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_context has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _configure_context(self, context: collections.OrderedDict):
                    """Configures the ZAP instance with the context.
            
                    Parameters
                    ----------
            Severity: Minor
            Found in scanners/zap-advanced/scanner/zapclient/context/zap_context.py - About 45 mins to fix

            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 deeply nested control flow statements.
            Open

                        switch(key) {
                          case "IP": newTarget.ipAddress = value.string[0]; break;
                          case "Title": newTarget.title = value.string[0]; break;
                          case "HTML5": newTarget.html5 = true; break;
                          case "Country": newTarget.country = value.string[0] + "/" + value.module[0]; break;
            Severity: Major
            Found in scanners/whatweb/parser/parser.js - About 45 mins to fix

              Function main has a Cognitive Complexity of 8 (exceeds 5 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 /
              
              
              Severity: Minor
              Found in documentation/src/docs.build.js - About 45 mins to fix

              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 _check_repo_is_in_time_frame has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _check_repo_is_in_time_frame(
                      self,
                      pushed_at: datetime,
                      start_time: Optional[datetime] = None,
                      end_time: Optional[datetime] = None,
              Severity: Minor
              Found in scanners/git-repo-scanner/scanner/git_repo_scanner/github_scanner.py - About 45 mins to fix

              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 _process_repos_page has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _process_repos_page(
                      self,
                      findings: List[FINDING],
                      repos: List[Repository],
                      start_time: Optional[datetime] = None,
              Severity: Minor
              Found in scanners/git-repo-scanner/scanner/git_repo_scanner/github_scanner.py - About 45 mins to fix

              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 process has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def process(args):
                  scanner: AbstractScanner
              
                  if args.git_type == "gitlab":
                      scanner = GitLabScanner(
              Severity: Minor
              Found in scanners/git-repo-scanner/scanner/git_repo_scanner/__main__.py - About 45 mins to fix

              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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Minor
              Found in scanners/git-repo-scanner/scanner/git_repo_scanner/github_scanner.py - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language