leafjs/orient

View on GitHub

Showing 65 of 143 total issues

Avoid deeply nested control flow statements.
Open

                                if ( one ) {
                                    query.limit(1);
                                }
Severity: Major
Found in lib/index.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                            if ( one ) {
                                                debug("creating just one?", m[0]);
                                                return model._createDocument(m[0]);
                                            }
    Severity: Major
    Found in lib/index.js - About 45 mins to fix

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

      export default function(type) {
          if(!type) {
              throw new Error('Type is not defined');
          } else if(type.isSchemaType) {
              return type;
      Severity: Minor
      Found in src/types/convert.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 ( one ) {
                                          query.limit(1);
                                      }
      Severity: Major
      Found in lib/index.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                                if ( one ) {
                                                    return Promise.resolve(model._createDocument(m[0]));
                                                }
        Severity: Major
        Found in lib/index.js - About 45 mins to fix

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

              toJSON(options) {
                  var json = {};
          
                  options = options || {};
          
          
          Severity: Minor
          Found in src/data.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 ( fn ) {
                                                  p = p.then(fn);
                                              }
          Severity: Major
          Found in lib/index.js - About 45 mins to fix

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

                _computeClassName(data, prop) {
                    var schemaType = prop.schemaType;
                    var options = prop.options;
                    var className = data._className;
                    var type = schemaType.getDbType(options);
            Severity: Minor
            Found in src/types/object.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 ( "link" !== rel.linkType ) {
                                            if ( rel.in ) {
                                                reverseCond = "out";
                                            } else if ( rel.out ) {
                                                reverseCond = "in";
            Severity: Major
            Found in lib/index.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                              if ( id._id ) {
                                                  id = id._id;
                                              }
              Severity: Major
              Found in lib/index.js - About 45 mins to fix

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

                    constructor (name, schema, connection, options, callback) {
                        super()
                        if(!name) {
                            throw new Error('Model name is not defined');
                        }
                Severity: Minor
                Found in src/model.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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    index(properties, options) {
                        options = options || {};
                
                        if(typeof properties === 'string') {
                            properties = { [properties]: 1 };
                Severity: Minor
                Found in src/schemas/index.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 _serialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    _serialize(value) {
                        var options = this.options;
                        var val = String(value);
                
                        if(options.enum && options.enum.indexOf(val) === -1) {
                Severity: Minor
                Found in src/types/string.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 condExec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    condExec(conditions, callback) {
                        if(typeof conditions === 'function') {
                            callback = conditions;
                            conditions = void 0;
                        }
                Severity: Minor
                Found in src/query.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

                Avoid too many return statements within this function.
                Open

                        return this;
                Severity: Major
                Found in src/schemas/index.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return BooleanType;
                  Severity: Major
                  Found in src/types/convert.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return DateType;
                    Severity: Major
                    Found in src/types/convert.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return data.get(newPath);
                      Severity: Major
                      Found in src/data.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return NumberType;
                        Severity: Major
                        Found in src/types/convert.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return propertyName + ' ' + operator + ' ' + param;
                          Severity: Major
                          Found in src/query.js - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language