leafjs/orient

View on GitHub

Showing 65 of 143 total issues

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

const glob = require('glob');
const debug = require('debug')("leafjs:http:middleware:orient");
const Orientose = require('../dist/orientose').default;
const Schema = Orientose.Schema;

Severity: Minor
Found in lib/index.js - About 1 day to fix

    File query.js has 462 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import OrientjsQuery from 'orientjs/lib/db/query';
    import debug from 'debug';
    import _ from 'lodash';
    import Document from './document';
    import GraphSchema from './schemas/graph';
    Severity: Minor
    Found in src/query.js - About 7 hrs to fix

      Function buildschema has 173 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          buildschema(parent) {
              var self = this;
              parent = parent || Schema.V;
              var schema = new parent(self._props, {
                  className: this._name
      Severity: Major
      Found in lib/index.js - About 6 hrs to fix

        Function exec has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

            exec(fn) {
        
                var model = this.model;
                var schema = model.schema;
                var operation = this._operation;
        Severity: Minor
        Found in src/query.js - About 6 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

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

        import {EventEmitter} from 'events';
        import Kareem from 'kareem';
        import _ from 'lodash';
        import VirtualType from '../types/virtual';
        import Data from '../data';
        Severity: Minor
        Found in src/schemas/index.js - About 5 hrs to fix

          Query has 38 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default class Query {
              constructor(model, options) {
                  options = options || {};
          
                  if(!model) {
          Severity: Minor
          Found in src/query.js - About 5 hrs to fix

            Function _ensureClass has 112 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _ensureClass(callback) {
                    var model = this;
                    var db = this.db;
                    var schema = this.schema;
                    var className = schema._options.className || this.name;
            Severity: Major
            Found in src/model.js - About 4 hrs to fix

              Function exec has 104 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  exec(fn) {
              
                      var model = this.model;
                      var schema = model.schema;
                      var operation = this._operation;
              Severity: Major
              Found in src/query.js - About 4 hrs to fix

                Schema has 32 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export default class Schema extends EventEmitter {
                    constructor(props, options) {
                        super();
                
                        props = props || {};
                Severity: Minor
                Found in src/schemas/index.js - About 4 hrs to fix

                  Function createComparisonQuery has a Cognitive Complexity of 24 (exceeds 5 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 3 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

                  File model.js has 306 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { EventEmitter } from 'events';
                  import Schema from './schemas/index';
                  import Document from './document';
                  import { waterfall, each, serial } from 'async';
                  import convertType from './types/convert';
                  Severity: Minor
                  Found in src/model.js - About 3 hrs to fix

                    Function normalizeOptions has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                        normalizeOptions(options) {
                            if(!options) {
                                return null;
                            }
                    
                    
                    Severity: Minor
                    Found in src/schemas/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 _ensureIndex has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _ensureIndex(OClass, callback) {
                            var db = this.db;
                            var className = this.name;
                            var schema = this.schema;
                            var model = this;
                    Severity: Major
                    Found in src/model.js - About 2 hrs to fix

                      Type has 25 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      export default class Type {
                          constructor (data, prop, name, mainData) {
                              if(!data || !prop || !name || !mainData) {
                                  throw new Error('Data or prop is undefined');
                              }
                      Severity: Minor
                      Found in src/types/type.js - About 2 hrs to fix

                        Document has 25 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        export default class Document extends EventEmitter {
                            constructor(model, properties, options) {
                                super()
                                properties = properties || {};
                        
                        
                        Severity: Minor
                        Found in src/document.js - About 2 hrs to fix

                          Function buildschema has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                              buildschema(parent) {
                                  var self = this;
                                  parent = parent || Schema.V;
                                  var schema = new parent(self._props, {
                                      className: this._name
                          Severity: Minor
                          Found in lib/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 initialize has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              * initialize(next) {
                                  let koa = this.koa;
                                  let http = this;
                          
                                  let _config = require("extend")({}, DEFAULTCONFIG, {
                          Severity: Major
                          Found in lib/index.js - About 2 hrs to fix

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

                            export default class Model extends EventEmitter {
                                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 2 hrs to fix

                              Function normalizeOptions has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  normalizeOptions(options) {
                                      if(!options) {
                                          return null;
                                      }
                              
                              
                              Severity: Major
                              Found in src/schemas/index.js - About 2 hrs to fix

                                Function queryLanguage has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    queryLanguage(conditions) {
                                        var items = [];
                                
                                        Object.keys(conditions).forEach(propertyName => {
                                
                                
                                Severity: Minor
                                Found in src/query.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language