jmdobry/reheat

View on GitHub

Showing 125 of 296 total issues

File filter.relations.test.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*jshint loopfunc:true*/

var Connection = require('../../../../build/instrument/lib/connection'),
    reheat = require('../../../../build/instrument/lib'),
    utils = require('../../../../build/instrument/lib/support/utils'),
Severity: Minor
Found in old_test/model/static/filter.relations.test.js - About 2 hrs to fix

    Function exports has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function (Promise, utils, errors) {
      var IllegalArgumentError = errors.IllegalArgumentError;
    
      /**
       * @doc method
    Severity: Minor
    Found in lib/model/prototype/clear.js - About 2 hrs 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 exports has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function (Promise, utils, errors) {
      var IllegalArgumentError = errors.IllegalArgumentError;
    
      /**
       * @doc method
    Severity: Minor
    Found in lib/model/prototype/unset.js - About 2 hrs 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 clone has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        clone: function (test) {
            test.expect(3);
    
            function constructor(attrs) {
                return {
    Severity: Major
    Found in old_test/reheat/model/prototype/index.test.js - About 2 hrs to fix

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

      module.exports = function (mout) {
        return {
          contains: mout.array.contains,
          every: mout.array.every,
          filter: mout.array.filter,
      Severity: Major
      Found in lib/support/utils.js - About 2 hrs to fix

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

        module.exports = function (Promise, utils, errors) {
          var IllegalArgumentError = errors.IllegalArgumentError;
        
          /**
           * @doc method
        Severity: Major
        Found in lib/model/prototype/set.js - About 2 hrs to fix

          Function exports has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function (utils, errors, Model_set, Model_setSync, Model_unset, Model_clear, Model_save, Model_destroy, Model_load) {
          
            return {
          
              /**
          Severity: Minor
          Found in lib/model/prototype/index.js - About 2 hrs 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

          File Gruntfile.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module.exports = function (grunt) {
          
              require('jit-grunt')(grunt, {
              simplemocha: 'grunt-simple-mocha'
            });
          Severity: Minor
          Found in Gruntfile.js - About 2 hrs to fix

            Function set has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function set(key, value, options, cb) {
                var _this = this;
            
                // Check pre-conditions
                if (utils.isFunction(value)) {
            Severity: Major
            Found in lib/model/prototype/set.js - About 2 hrs to fix

              Function defineModel has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                reheat.defineModel = function (name, staticProps, protoProps) {
                  if (!utils.isString(name)) {
                    throw new errors.IllegalArgumentError(errorPrefix + 'name: Must be a string!', { name: { actual: typeof name, expected: 'string' } });
                  } else if (models[name]) {
                    throw new errors.RuntimeError(errorPrefix + 'name: A Model with that name already exists!');
              Severity: Minor
              Found in lib/index.js - About 2 hrs to fix

                Function findAll has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function findAll(predicate, options, cb) {
                    if (utils.isFunction(options)) {
                      cb = options;
                      options = {};
                    }
                Severity: Minor
                Found in lib/collection/static/findAll.js - About 1 hr to fix

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

                  module.exports = function (utils, errors) {
                    var IllegalArgumentError = errors.IllegalArgumentError,
                      ValidationError = errors.ValidationError,
                      UnhandledError = errors.UnhandledError;
                  
                  
                  Severity: Minor
                  Found in lib/model/prototype/setSync.js - About 1 hr to fix

                    Function setSync has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function setSync(key, value, options) {
                        // Check pre-conditions
                        if (utils.isObject(key) && !options) {
                          options = value;
                        }
                    Severity: Minor
                    Found in lib/model/prototype/setSync.js - About 1 hr to fix

                      Function createLifecycle has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          createLifecycle: function (test) {
                              test.expect(9);
                      
                              var Post = reheat.defineModel('Post', {
                                  tableName: tableName,
                      Severity: Minor
                      Found in old_test/model/index.test.js - About 1 hr to fix

                        Function viewSource has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        docsApp.directive.viewSource = function ($timeout, $compile) {
                            return {
                                restrict: 'E',
                                replace: true,
                                template: [
                        Severity: Minor
                        Found in guide/reheat.js - About 1 hr to fix

                          Function exports has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports = function (container, utils, errors, Collection_prototype, Collection_findAll, Collection_getAll) {
                          
                            /**
                             * @doc function
                             * @name Collection
                          Severity: Minor
                          Found in lib/collection/index.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 exports has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = function (utils, Model_findOne, Model_prototype, Model_destroyOne) {
                          
                            /**
                             * @doc function
                             * @name Model
                          Severity: Minor
                          Found in lib/model/index.js - About 1 hr to fix

                            Function normal has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                normal: function (test) {
                                    test.expect(3);
                            
                                    var instance = {
                                        attributes: {
                            Severity: Minor
                            Found in old_test/reheat/model/prototype/save.test.js - About 1 hr to fix

                              Function sanitize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  return Promise.resolve().bind(this).then(function sanitize() {
                              
                                    if (!utils.isObject(predicate)) {
                                      throw new IllegalArgumentError(errorPrefix + 'predicate: Must be an object!', { actual: typeof predicate, expected: 'object' });
                                    } else if (!utils.isObject(options)) {
                              Severity: Minor
                              Found in lib/collection/static/findAll.js - About 1 hr to fix

                                Function options has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    options: function (test) {
                                        test.expect(8);
                                
                                        var instance = {
                                            attributes: {
                                Severity: Minor
                                Found in old_test/reheat/model/prototype/save.test.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language