diegopamio/angular-sails-bind

View on GitHub

Showing 6 of 6 total issues

Function bind has 119 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        var bind = function (resourceName, $scope, subset, callback) {

            var prefix = resourceName.split('/');
            if (prefix.length > 1) {
                resourceName = prefix.splice(prefix.length - 1, 1);
Severity: Major
Found in lib/angular-sails-bind.js - About 4 hrs to fix

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

module.exports = function (config) {
    'use strict';
    var environment = process.env.NODE_ENV || 'dev',
        customLaunchersByEnvironment = {
            test: {
Severity: Major
Found in karma.config.js - About 3 hrs to fix

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

module.exports = function (grunt) {
    'use strict';
    // Project configuration.
    grunt.initConfig({
        // Metadata.
Severity: Major
Found in Gruntfile.js - About 3 hrs to fix

Function onMessage has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            function onMessage(message) {
                var elements = $scope[resourceName + "s"],
                    actions = {
                        created: function () {
                            $scope[resourceName + "s"].push(message.data);
Severity: Major
Found in lib/angular-sails-bind.js - About 2 hrs to fix

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

        value: function(predicate) {
            if (this == null) {
                throw new TypeError('Array.prototype.find called on null or undefined');
            }
            if (typeof predicate !== 'function') {
Severity: Minor
Found in lib/utils.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 init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            function init() {
                $scope.$watchCollection(resourceName + "s", function (newValues, oldValues) {
                    var addedElements, removedElements;
                    newValues = newValues || [];
                    oldValues = oldValues || [];
Severity: Minor
Found in lib/angular-sails-bind.js - About 1 hr to fix
Severity
Category
Status
Source
Language