CodeCharmLtd/http-master

View on GitHub
src/certScanner.js

Summary

Maintainability
D
2 days
Test Coverage

Function constructor has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(sslDirectory, options) {
    super();
    
    this.options = options;
    
Severity: Major
Found in src/certScanner.js - About 4 hrs to fix

    Function scan has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      scan(cb) {
        var outputConfig = {};
    
        var keys = {};
        var certs = {};
    Severity: Major
    Found in src/certScanner.js - About 4 hrs to fix

      Function processDirectory has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          let processDirectory = (dirName, cb) => {
            fs.readdir(dirName, (err, files) => {
              if(err) return cb(err);
      
              async.each(files, (certFile, cb) => {
      Severity: Major
      Found in src/certScanner.js - About 3 hrs to fix

        Function constructor has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          constructor(sslDirectory, options) {
            super();
            
            this.options = options;
            
        Severity: Minor
        Found in src/certScanner.js - About 2 hrs 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 getCaFor has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.getCaFor = async.memoize((certPath, cb) => {
              this.readPart(certPath, 65636, (err, rawCert) => {
                if(err) return cb(err);
        
                var parsedCert;
        Severity: Major
        Found in src/certScanner.js - About 2 hrs to fix

          File certScanner.js has 258 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          var x509 = require('x509.js');
          var fs = require('fs');
          var async = require('async');
          Severity: Minor
          Found in src/certScanner.js - About 2 hrs to fix

            Function processDirectory has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    let processDirectory = (dirName, cb) => {
                      fs.readdir(dirName, (err, files) => {
            
                        if(err) return cb(err);
            
            
            Severity: Minor
            Found in src/certScanner.js - About 1 hr to fix

              Avoid too many return statements within this function.
              Open

                                return cb(null);
              Severity: Major
              Found in src/certScanner.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                  return cb();
                Severity: Major
                Found in src/certScanner.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return cb();
                  Severity: Major
                  Found in src/certScanner.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return cb(err);
                    Severity: Major
                    Found in src/certScanner.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                          return cb();
                      Severity: Major
                      Found in src/certScanner.js - About 30 mins to fix

                        There are no issues that match your filters.

                        Category
                        Status