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;
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';
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
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;
- Read upRead up
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';
Query
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Query {
constructor(model, options) {
options = options || {};
if(!model) {
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;
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;
Schema
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Schema extends EventEmitter {
constructor(props, options) {
super();
props = props || {};
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;
- Read upRead up
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';
Function normalizeOptions
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
normalizeOptions(options) {
if(!options) {
return null;
}
- Read upRead up
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;
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');
}
Document
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Document extends EventEmitter {
constructor(model, properties, options) {
super()
properties = properties || {};
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
- Read upRead up
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, {
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');
Function normalizeOptions
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
normalizeOptions(options) {
if(!options) {
return null;
}
Function queryLanguage
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
queryLanguage(conditions) {
var items = [];
Object.keys(conditions).forEach(propertyName => {