leafjs/orient

View on GitHub

Showing 65 of 143 total issues

Function _reverseLocate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                            schema.static("findBy"+name, function _reverseLocate(id){
                                if ( id._id ) {
                                    id = id._id;
                                }
                                var self = this;
Severity: Minor
Found in lib/index.js - About 1 hr to fix

    Function createComparisonQuery has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        createComparisonQuery(propertyName, operator, value) {
            var param;
            var type = this.schema.getSchemaType(propertyName);
            if ( value && true === value.__orientose_raw__ ) {
                param = value;
    Severity: Minor
    Found in src/query.js - About 1 hr to fix

      Function _getRelation has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                                  schema.method(methodName, function _getRelation(){
                                      var self = this;
                                      var query = this._orientose()
                                              ._db
                                              .select()
      Severity: Minor
      Found in lib/index.js - About 1 hr to fix

        Function createClass has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static createClass (model) {
                class DocumentModel extends Document {
                    constructor(properties) {
                        super(model, properties);
                    }
        Severity: Minor
        Found in src/document.js - About 1 hr to fix

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

              save(callback) {
                  var hooks = this._model.schema.hooks;
                  var self = this;
                  return new Promise(function(resolve, reject){
                      hooks.execPre('validate', self, error => {
          Severity: Minor
          Found in src/document.js - About 1 hr to fix

            Function setPath has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                setPath(path, options) {
                    // ignore {_id: false}
                    if(options === false) {
                        return this;
                    }
            Severity: Minor
            Found in src/schemas/index.js - About 1 hr to fix

              Function virtual has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  virtual(path, options) {
                      options = options || {};
              
                      var schema = this;
                      var pos = path.indexOf('.');
              Severity: Minor
              Found in src/schemas/index.js - About 1 hr to fix

                Function constructor has 32 lines of code (exceeds 25 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 1 hr to fix

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

                      set (path, value, setAsOriginal) {
                          if(_.isPlainObject(path)) {
                              for(var key in path) {
                                  this.set(key, path[key], setAsOriginal);
                              }
                  Severity: Minor
                  Found in src/data.js - About 1 hr to fix

                    Function set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        set (path, value, setAsOriginal) {
                            if(_.isPlainObject(path)) {
                                for(var key in path) {
                                    this.set(key, path[key], setAsOriginal);
                                }
                    Severity: Minor
                    Found in src/data.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 setPath has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        setPath(path, options) {
                            // ignore {_id: false}
                            if(options === false) {
                                return this;
                            }
                    Severity: Minor
                    Found in src/schemas/index.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 index has 31 lines of code (exceeds 25 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 1 hr to fix

                      Function prepareSchema has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function prepareSchema(schema) {
                          schema.add({
                              '@type'    : { type: String, readonly: true, metadata: true, query: true, default: 'document' },
                              '@class'   : { type: String, readonly: true, metadata: true, query: true, default: getDefaultClassName},
                              '@rid'     : { type: RID, readonly: true, metadata: true },
                      Severity: Minor
                      Found in src/schemas/orient/index.js - About 1 hr to fix

                        Function constructor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            constructor(model, options) {
                                options = options || {};
                        
                                if(!model) {
                                    throw new Error('Model is not defined');
                        Severity: Minor
                        Found in src/query.js - About 1 hr to fix

                          Function getConfig has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              static getConfig(http) {
                                  let config = require("extend")({}, DEFAULTCONFIG, {
                                      connection: {}
                                  });
                                  var _config = http._config.db || {};
                          Severity: Minor
                          Found in lib/index.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                                    if ( "link" in rel || "in" in rel || "out" in rel || "both" in rel ) {
                                                        var cond = rel.link || rel.in || rel.out || rel.both;
                                                        var reverseCond;
                                                        if ( "link" !== rel.linkType ) {
                                                            if ( rel.in ) {
                            Severity: Major
                            Found in lib/index.js - About 1 hr to fix

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

                                  virtual(path, options) {
                                      options = options || {};
                              
                                      var schema = this;
                                      var pos = path.indexOf('.');
                              Severity: Minor
                              Found in src/schemas/index.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 toObject has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  toObject(options) {
                                      var json = {};
                              
                                      options = options || {};
                              
                              
                              Severity: Minor
                              Found in src/data.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

                              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 genModel has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                function genModel(file, remove, orientose, app, builders, parentSchema) {
                                Severity: Minor
                                Found in lib/index.js - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language