arlac77/sorm

View on GitHub

Showing 12 of 14 total issues

File module.js has 560 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* jslint node: true, esnext: true */

'use strict';

const crypto = require('crypto'),
Severity: Major
Found in src/module.js - About 1 day to fix

    Function exec_ddl has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      exec_ddl(db, createOptions, callback) {
    
        if (!createOptions)
          createOptions = {
            'load_data': true
    Severity: Major
    Found in src/module.js - About 2 hrs to fix

      Function parse_constraints has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      function parse_constraints(ps, cs) {
        let gotSomething;
        let str = ps.input;
      
        if (str) {
      Severity: Minor
      Found in src/module.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 tables_from_db has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function tables_from_db(db, callback) {
        db.all("SELECT name,sql FROM sqlite_master WHERE type='table'", (error, rows) => {
          if (error) {
            callback(error);
            return;
      Severity: Minor
      Found in src/module.js - About 1 hr to fix

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

          migrate_data(db, data_sets, callback) {
            const update = function (table, sql, values) {
              const v = [];
              const l = table.pk().length;
        
        
        Severity: Minor
        Found in src/module.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 pk has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            pk() {
              const pk = [];
        
              for (const i in this.attributes) {
                const a = this.attributes[i];
        Severity: Minor
        Found in src/module.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 Constraint has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export function Constraint(type, properties) {
        
          if (typeof type === 'string') {
            let c = constraints[type.toUpperCase()];
            if (c) {
        Severity: Minor
        Found in src/module.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 migrate_data has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          migrate_data(db, data_sets, callback) {
            const update = function (table, sql, values) {
              const v = [];
              const l = table.pk().length;
        
        
        Severity: Minor
        Found in src/module.js - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                    if (oc.parse) {
                      str = oc.parse(m, cs, oc);
                    } else {
                      str = m[1];
                      cs.push(Constraint(oc));
          Severity: Major
          Found in src/module.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if (m) {
                          const aname = unquote(m[1]);
                          const type = m[4];
                          ps.input = m[6];
            
            
            Severity: Major
            Found in src/module.js - About 45 mins to fix

              Function Attribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              export function Attribute(name, type, cs) {
              
                const constraints = [];
              
                if (cs instanceof Array) {
              Severity: Minor
              Found in src/module.js - About 35 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 Table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export function Table(name, attributes, constraints) {
              
                for (const i in attributes) {
                  const a = attributes[i];
                  if (!(a instanceof Attribute))
              Severity: Minor
              Found in src/module.js - About 25 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