atsid/schematic-js

View on GitHub

Showing 6 of 23 total issues

Function ModelWrapper has 194 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            ModelWrapper = function (schema, obj, validators, options) {

                var basedOn = obj, data = obj || {}, that = this,
                    lastErrors,
                    createSubModels = options && options.createSubModels,
Severity: Major
Found in js/ModelFactory.js - About 7 hrs to fix

    File ModelFactory.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @class ModelFactory
     * Factory for creating schema-based models. If Backbone exists, the factory
     * will create a schema-based Backbone model.
     */
    Severity: Minor
    Found in js/ModelFactory.js - About 3 hrs to fix

      Function exports has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function (grunt) {
      
          grunt.initConfig({
              jshint: {
                  src: ['js/**/*.js', 'test/**/*.js', 'example/**/*.js', '!node_modules/**/*.*', '!**/lib/**/*.js', '!js/declare.js'],
      Severity: Minor
      Found in Gruntfile.js - About 1 hr to fix

        Function indexOf has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            indexOf: function (val, array) {
                'use strict';
                if (!Array.prototype.indexOf) {
                    Array.prototype.indexOf = function (obj, fromIndex) {
                        if (fromIndex === null) {
        Severity: Minor
        Found in js/util.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 module has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var module = function (config) {
        
                this.message = {code: 0, message: 'Invalid number'};
                util.mixin(this, config);
        
        
        Severity: Minor
        Found in js/plugins/LuhnValidationPlugin.js - About 1 hr to fix

          Function exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(config) {
            config.set({
          
              // base path, that will be used to resolve files and exclude
              basePath: '',
          Severity: Minor
          Found in karma.conf.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language