FreeAllMedia/dovima

View on GitHub
es6/lib/model/index.js

Summary

Maintainability
D
1 day
Test Coverage

Model has 37 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Model {
    /**
     * @param {Object.<String,*>} [initialAttributes] Provide default values for attributes by passing a Key-Value Object.
     * @constructor
     */
Severity: Minor
Found in es6/lib/model/index.js - About 4 hrs to fix

    File index.js has 320 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* Component Dependencies */
    import Async from "flowsync";
    import inflect from "jargon";
    import privateData from "incognito";
    
    
    Severity: Minor
    Found in es6/lib/model/index.js - About 3 hrs to fix

      Function invalidAttributes has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          invalidAttributes(callback) {
              const _ = privateData(this);
              const attributeNamesWithValidators = Object.keys(_.validations);
      
              const compileInvalidAttributeList = (errors, validatorMessages) => {
      Severity: Minor
      Found in es6/lib/model/index.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 invalidAttributes has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          invalidAttributes(callback) {
              const _ = privateData(this);
              const attributeNamesWithValidators = Object.keys(_.validations);
      
              const compileInvalidAttributeList = (errors, validatorMessages) => {
      Severity: Major
      Found in es6/lib/model/index.js - About 2 hrs to fix

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

            [symbols.callDeep] (methodName, predicate, callback) {
                const associationNames = Object.keys(this.associations);
        
                Async.mapParallel(
                    associationNames,
        Severity: Minor
        Found in es6/lib/model/index.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

            There are no issues that match your filters.

            Category
            Status