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;
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;
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()
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);
}
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 => {
Function setPath
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
setPath(path, options) {
// ignore {_id: false}
if(options === false) {
return this;
}
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('.');
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');
}
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);
}
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);
}
- 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 setPath
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
setPath(path, options) {
// ignore {_id: false}
if(options === false) {
return this;
}
- 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 index
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
index(properties, options) {
options = options || {};
if(typeof properties === 'string') {
properties = { [properties]: 1 };
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 },
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');
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 || {};
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 ) {
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('.');
- 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 toObject
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
toObject(options) {
var json = {};
options = options || {};
- 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
Avoid deeply nested control flow statements. Open
if ( fn ) {
p = p.then(fn);
}
Function genModel
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function genModel(file, remove, orientose, app, builders, parentSchema) {