Showing 14 of 16 total issues
File adapter.js
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import Knex from 'knex'
import _ from 'lodash'
import camelize from 'camelize'
import WaterlineSequel from 'waterline-sequel'
File util.js
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import _ from 'lodash'
import Adapter from './adapter'
import CriteriaParser from 'waterline-sequel/sequel/lib/criteriaProcessor'
import SpatialUtil from './spatial'
import Procedures from './procedures'
Util
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
Open
const Util = {
PG_MAX_INT: 2147483647,
initializeConnection (cxn) {
Function toKnexColumn
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
toKnexColumn (table, _name, attrDefinition, wlModel, schema) {
let attr = _.isObject(attrDefinition) ? attrDefinition : { type: attrDefinition }
let type = attr.autoIncrement ? 'serial' : attr.type
let name = attr.columnName || _name
Adapter
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
Open
const Adapter = {
identity: 'waterline-postgresql',
wlSqlOptions: {
Function toKnexColumn
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
toKnexColumn (table, _name, attrDefinition, wlModel, schema) {
let attr = _.isObject(attrDefinition) ? attrDefinition : { type: attrDefinition }
let type = attr.autoIncrement ? 'serial' : attr.type
let name = attr.columnName || _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 applyParticularColumnConstraint
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
applyParticularColumnConstraint (column, constraintName, value, definition) {
if (!value) return
switch (constraintName) {
- 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 registerConnection
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
registerConnection (connection, collections, cb) {
if (!connection.identity) {
return cb(WaterlineError.adapter.IdentityMissing)
}
if (Adapter.connections.get(connection.identity)) {
Function update
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
update (connectionName, tableName, options, data, cb) {
Function query
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
query (connectionName, tableName, queryString, args, cb) {
Function addAttribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
addAttribute (connectionName, tableName, attributeName, definition, cb) {
Function toKnexColumn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
toKnexColumn (table, _name, attrDefinition, wlModel, schema) {
Avoid too many return
statements within this function. Open
Open
return value
Avoid too many return
statements within this function. Open
Open
return column.defaultTo(knex.raw('uuid_generate_v4()'))