Tireo/pg-patch

View on GitHub

Showing 8 of 12 total issues

Function run has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    run: function () {
        let processCache = {};
        let scanner = this.scanner;
        let dbManager = this.db;

Severity: Major
Found in lib/process.js - About 3 hrs to fix

    Function init has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        init: function () {
            this.createConsoleInvokers();
            this.registerMsgHandlers({
                'ERROR.*': (data) => {
                    this.error(data);
    Severity: Major
    Found in lib/reporters/console-reporter.js - About 2 hrs to fix

      File process.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      
      const q = require('q');
      const path = require('path');
      
      
      Severity: Minor
      Found in lib/process.js - About 2 hrs to fix

        Function loadSQLData has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            loadSQLData: function (sourceVersion, targetVersion, routeData) {
                let action = common.determineAction(sourceVersion, targetVersion);
                let versionSeq = common.generateVersionPatchSequence(sourceVersion, targetVersion);
        
                let versionSqlGetPromises = [];
        Severity: Minor
        Found in lib/process.js - About 1 hr to fix

          Function init has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              init: function () {
                  this.createConsoleInvokers();
                  this.registerMsgHandlers({
                      'ERROR.*': (data) => {
                          this.error(data);
          Severity: Minor
          Found in lib/reporters/console-reporter.js - About 1 hr 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 scanDirectoryForPatchFiles has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              scanDirectoryForPatchFiles: function (dirPath, rData) {
                  dirPath = common.determineValue(dirPath, []);
                  rData = common.determineValue(rData, this.createEmptyPatchDataObject());
          
                  let currentSubDir = dirPath.join('/');
          Severity: Minor
          Found in lib/file-scanner.js - About 1 hr to fix

            Function validatePatchFileTemplate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                validatePatchFileTemplate: function () {
                    let template = this.patchFileTemplate;
                    let found = {
                        action: /\$ACTION/g.test(template),
                        version: /\$VERSION/g.test(template),
            Severity: Minor
            Found in lib/file-scanner.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 getPatchFileProperties has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                getPatchFileProperties: function (fName) { //TODO: improve handling of invalid templateMode?
                    let version = null, action = null, source = null, target = null, diff = null;
            
                    if (this.patchFileTemplateMode === patchFileTemplateMode.AV) {
                        version = this.getPatchFileVersion(fName);
            Severity: Minor
            Found in lib/file-scanner.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

            Severity
            Category
            Status
            Source
            Language