Showing 36 of 95 total issues
File schemasaurus.js
has 1009 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.schemasaurus = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";
var CurrentObject = require('./int/context');
var Context = CurrentObject;
Function 14
has 280 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],14:[function(require,module,exports){
"use strict";
var messages = require('./messages');
var fillDefaultFormats = require('./int/default_formats');
Function 1
has 185 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.schemasaurus = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";
var CurrentObject = require('./int/context');
var Context = CurrentObject;
prototype
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
Open
V4Validator.prototype = {
toComparable: function (o) {
return typeof o === 'object' ? JSON.stringify(o) : o;
},
error: function (code, ctx, arg, pathReplacement) {
Function 7
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],7:[function(require,module,exports){
"use strict";
var Generator = require('./gen');
function SchemaPartProcessor(vargen, codeComposer, options) {
File v4validator.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"use strict";
var messages = require('./messages');
var fillDefaultFormats = require('./int/default_formats');
function isObject(o) {
Function 3
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"../interpolate":10,"./gen":5}],3:[function(require,module,exports){
"use strict";
function CurrentObject(path) {
this.path = path ? path.slice() : [];
Function 6
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],6:[function(require,module,exports){
"use strict";
var attrRe = /(\[(\^?[\-_\w]+)(=[\-_\w]+)?\])/g;
var modRe = /:([\-\w]+)$/;
Function 13
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{}],13:[function(require,module,exports){
"use strict";
function Normalizer() {
Function 2
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./int/code":2,"./int/context":3,"./int/gen":5,"./int/matchers":6,"./int/processor":7,"./int/references":8,"./int/shared":9}],2:[function(require,module,exports){
"use strict";
var Generator = require('./gen');
var interpolate = require('../interpolate');
Function 12
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
},{"./compiler":1,"./normalizer":13,"./v4validator":14,"./validator_extend":15}],12:[function(require,module,exports){
"use strict";
module.exports = function messages(gettext) {
return {
Function messages
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function messages(gettext) {
return {
"string": gettext("shall be a string"),
"null": gettext("shall be null"),
"minLength": gettext("shall have length at least %d"),
Function messages
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function messages(gettext) {
return {
"string": gettext("shall be a string"),
"null": gettext("shall be null"),
"minLength": gettext("shall have length at least %d"),
Function processRequired
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
processRequired: function (reqs) {
if (Array.isArray(reqs)) {
return function (s, o, ctx) {
if (!isObject(o)) {
return;
- 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 processItems
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
SchemaPartProcessor.prototype.processItems = function (step) {
if (!step.schema.items && !step.schema.additionalItems) {
return;
}
var idxvar, newvar, k;
Function processItems
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
SchemaPartProcessor.prototype.processItems = function (step) {
if (!step.schema.items && !step.schema.additionalItems) {
return;
}
var idxvar, newvar, k;
Function [type]
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
"[type]": function (schema, object, ctx) {
var isTrue, isFalse;
if (notDefined(object)) {
return;
}
Function createMatcher
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createMatcher(expr) {
var ma = modRe.exec(expr), props = [], attr, not, i;
if (ma) {
attr = ma[1];
}
Function createMatcher
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createMatcher(expr) {
var ma = modRe.exec(expr), props = [], attr, not, i;
if (ma) {
attr = ma[1];
}
Function [type]
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
"[type]": function (schema, object, ctx) {
var isTrue, isFalse;
if (notDefined(object)) {
return;
}