AlexeyGrishin/schemasaurus

View on GitHub

Showing 36 of 95 total issues

File schemasaurus.js has 1009 lines of code (exceeds 250 allowed). Consider refactoring.
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;
Severity: Major
Found in schemasaurus.js - About 2 days to fix

    Function 14 has 280 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    },{}],14:[function(require,module,exports){
    "use strict";
    var messages = require('./messages');
    var fillDefaultFormats = require('./int/default_formats');
    
    
    Severity: Major
    Found in schemasaurus.js - About 1 day to fix

      Function 1 has 185 lines of code (exceeds 25 allowed). Consider refactoring.
      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;
      Severity: Major
      Found in schemasaurus.js - About 7 hrs to fix

        prototype has 35 functions (exceeds 20 allowed). Consider refactoring.
        Open

        V4Validator.prototype = {
            toComparable: function (o) {
                return typeof o === 'object' ? JSON.stringify(o) : o;
            },
            error: function (code, ctx, arg, pathReplacement) {
        Severity: Minor
        Found in src/v4validator.js - About 4 hrs to fix

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

          },{}],7:[function(require,module,exports){
          "use strict";
          var Generator = require('./gen');
          
          function SchemaPartProcessor(vargen, codeComposer, options) {
          Severity: Major
          Found in schemasaurus.js - About 4 hrs to fix

            File v4validator.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            "use strict";
            var messages = require('./messages');
            var fillDefaultFormats = require('./int/default_formats');
            
            function isObject(o) {
            Severity: Minor
            Found in src/v4validator.js - About 2 hrs to fix

              Function 3 has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              },{"../interpolate":10,"./gen":5}],3:[function(require,module,exports){
              "use strict";
              
              function CurrentObject(path) {
                  this.path = path ? path.slice() : [];
              Severity: Major
              Found in schemasaurus.js - About 2 hrs to fix

                Function 6 has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                },{}],6:[function(require,module,exports){
                "use strict";
                
                var attrRe = /(\[(\^?[\-_\w]+)(=[\-_\w]+)?\])/g;
                var modRe = /:([\-\w]+)$/;
                Severity: Major
                Found in schemasaurus.js - About 2 hrs to fix

                  Function 13 has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  },{}],13:[function(require,module,exports){
                  "use strict";
                  
                  function Normalizer() {
                  
                  
                  Severity: Major
                  Found in schemasaurus.js - About 2 hrs to fix

                    Function 2 has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    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');
                    
                    
                    Severity: Major
                    Found in schemasaurus.js - About 2 hrs to fix

                      Function 12 has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      },{"./compiler":1,"./normalizer":13,"./v4validator":14,"./validator_extend":15}],12:[function(require,module,exports){
                      "use strict";
                      
                      module.exports = function messages(gettext) {
                          return {
                      Severity: Minor
                      Found in schemasaurus.js - About 1 hr to fix

                        Function messages has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        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"),
                        Severity: Minor
                        Found in src/messages.js - About 1 hr to fix

                          Function messages has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          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"),
                          Severity: Minor
                          Found in schemasaurus.js - About 1 hr to fix

                            Function processRequired has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                processRequired: function (reqs) {
                                    if (Array.isArray(reqs)) {
                                        return function (s, o, ctx) {
                                            if (!isObject(o)) {
                                                return;
                            Severity: Minor
                            Found in src/v4validator.js - About 1 hr 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 processItems has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            SchemaPartProcessor.prototype.processItems = function (step) {
                                if (!step.schema.items && !step.schema.additionalItems) {
                                    return;
                                }
                                var idxvar, newvar, k;
                            Severity: Minor
                            Found in schemasaurus.js - About 1 hr to fix

                              Function processItems has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              SchemaPartProcessor.prototype.processItems = function (step) {
                                  if (!step.schema.items && !step.schema.additionalItems) {
                                      return;
                                  }
                                  var idxvar, newvar, k;
                              Severity: Minor
                              Found in src/int/processor.js - About 1 hr to fix

                                Function [type] has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    "[type]": function (schema, object, ctx) {
                                        var isTrue, isFalse;
                                        if (notDefined(object)) {
                                            return;
                                        }
                                Severity: Minor
                                Found in src/normalizer.js - About 1 hr to fix

                                  Function createMatcher has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function createMatcher(expr) {
                                      var ma = modRe.exec(expr), props = [], attr, not, i;
                                      if (ma) {
                                          attr = ma[1];
                                      }
                                  Severity: Minor
                                  Found in schemasaurus.js - About 1 hr to fix

                                    Function createMatcher has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function createMatcher(expr) {
                                        var ma = modRe.exec(expr), props = [], attr, not, i;
                                        if (ma) {
                                            attr = ma[1];
                                        }
                                    Severity: Minor
                                    Found in src/int/matchers.js - About 1 hr to fix

                                      Function [type] has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          "[type]": function (schema, object, ctx) {
                                              var isTrue, isFalse;
                                              if (notDefined(object)) {
                                                  return;
                                              }
                                      Severity: Minor
                                      Found in schemasaurus.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language