FreeAllMedia/dovima

View on GitHub

Showing 39 of 148 total issues

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

function softDelete(callback) {
  if(this[this.primaryKey]) {
    flowsync.series([
      (next) => {
        this[symbols.callDeep]("delete", (associationDetails) => {
Severity: Minor
Found in es6/lib/model/delete.js - About 1 hr to fix

    Function toString has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        toString() {
            const _ = privateData(this);
    
            let chainString = _.ModelConstructor.name;
    
    
    Severity: Minor
    Found in es6/lib/modelFinder.js - About 1 hr to fix

      Function performValidationsForAttribute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              const performValidationsForAttribute = (attributeName, done) => {
                  const attributeValidations = _.validations[attributeName];
      
                  const performValidation = (validation, returnValue) => {
                      const validator = validation.validator;
      Severity: Minor
      Found in es6/lib/model/index.js - About 1 hr to fix

        Function callDatabase has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            [callDatabase](callback) {
                const _ = privateData(this);
        
                this[validateDependencies]();
        
        
        Severity: Minor
        Found in es6/lib/modelFinder.js - About 1 hr to fix

          Function results has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              results(callbackOrMockValue) {
                  const _ = privateData(this);
          
                  if (_.isMockDefinition) {
                      const mockValue = callbackOrMockValue;
          Severity: Minor
          Found in es6/lib/modelFinder.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 fetch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              fetch(callback) {
                  function processWhereCondition(value) {
                      if (typeof value === "string") {
                          const snakeCasedValue = inflect(value).snake.toString();
                          return snakeCasedValue;
          Severity: Minor
          Found in es6/lib/collection.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 argumentsEqual has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              [argumentsEqual](argumentsA, argumentsB) {
                  if (argumentsA === argumentsB) {
                      return true;
                  } else {
                      if (argumentsA.length === argumentsB.length) {
          Severity: Minor
          Found in es6/lib/modelFinder.js - About 1 hr to fix

            Function save has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function save(callback) {
              flowsync.series([
                (next) => {
                  this.beforeValidation(next);
                },
            Severity: Minor
            Found in es6/lib/model/save.js - About 1 hr to fix

              Function equalTo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  equalTo(query) {
                      const ourChain = this.chain;
                      const theirChain = query.chain;
              
                      let isEqual = true;
              Severity: Minor
              Found in es6/lib/modelFinder.js - About 1 hr to fix

                Function push has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    push(...models) {
                        models.forEach(model => {
                            if (this.indexOf(model) === -1) {
                                if(this.association) {
                                    super.push(model);
                Severity: Minor
                Found in es6/lib/collection.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (this[argumentsEqual](ourArguments, theirArguments)) {
                                              hasMatchingLink = true;
                                              break;
                                          }
                  Severity: Major
                  Found in es6/lib/modelFinder.js - About 45 mins to fix

                    Function fetchWhere has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function fetchWhere(modelClass, key, conditionType, ids, target, callback) {
                    Severity: Minor
                    Found in es6/lib/model/fetch.js - About 45 mins to fix

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

                      function fetchByHasOne(associationName, associations, callback) {
                        const modelFinder = new ModelFinder(this.database);
                        const association = associations[associationName];
                        const ModelClass = association.constructor;
                      
                      
                      Severity: Minor
                      Found in es6/lib/model/fetch.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

                      Avoid deeply nested control flow statements.
                      Open

                                if (attributeName !== this.primaryKey) {
                                  updateAttributes[attributeName] = attributes[attributeName];
                                }
                      Severity: Major
                      Found in es6/lib/model/save.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (argumentA instanceof RegExp) {
                                                    if (argumentB.toString().match(argumentA) === null) {
                                                        return false;
                                                    }
                                                } else if (argumentB instanceof RegExp) {
                        Severity: Major
                        Found in es6/lib/modelFinder.js - About 45 mins to fix

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

                          export default function fetch(...options) {
                            switch(options.length) {
                              case 0:
                                fetchBy.call(this);
                                break;
                          Severity: Minor
                          Found in es6/lib/model/fetch.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 countAssociationHasMany has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function countAssociationHasMany(model, associationModel, association, resultDetails, callback) {
                          Severity: Minor
                          Found in es6/lib/validation/isPresent.js - About 35 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return false;
                            Severity: Major
                            Found in es6/lib/modelFinder.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return true;
                              Severity: Major
                              Found in es6/lib/modelFinder.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language