creative-workflow/pi-setup

View on GitHub
services/pisound/src/web/htdocs/js/sammy.js

Summary

Maintainability
F
5 days
Test Coverage

File sammy.js has 1103 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// name: sammy
// version: 0.7.4

// Sammy.js / http://sammyjs.org

Severity: Major
Found in services/pisound/src/web/htdocs/js/sammy.js - About 2 days to fix

    Function runRoute has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        runRoute: function(verb, path, params, target) {
          var app = this,
              route = this.lookupRoute(verb, path),
              context,
              wrapped_route,
    Severity: Major
    Found in services/pisound/src/web/htdocs/js/sammy.js - About 3 hrs to fix

      Function load has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          load: function(location, options, callback) {
            var context = this;
            return this.then(function() {
              var should_cache, cached, is_json, location_array;
              if (_isFunction(options)) {
      Severity: Major
      Found in services/pisound/src/web/htdocs/js/sammy.js - About 2 hrs to fix

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

            contextMatchesOptions: function(context, match_options, positive) {
              var options = match_options;
              // normalize options
              if (typeof options === 'string' || _isRegExp(options)) {
                options = {path: options};
        Severity: Minor
        Found in services/pisound/src/web/htdocs/js/sammy.js - About 1 hr to fix

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

              bind: function() {
                var proxy = this, app = this.app, lp = Sammy.DefaultLocationProxy;
                $(window).bind('hashchange.' + this.app.eventNamespace(), function(e, non_native) {
                  // if we receive a native hash change event, set the proxy accordingly
                  // and stop polling
          Severity: Minor
          Found in services/pisound/src/web/htdocs/js/sammy.js - About 1 hr to fix

            Function renderEach has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                renderEach: function(location, name, data, callback) {
                  if (_isArray(name)) {
                    callback = data;
                    data = name;
                    name = null;
            Severity: Minor
            Found in services/pisound/src/web/htdocs/js/sammy.js - About 1 hr to fix

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

                  route: function(verb, path) {
                    var app = this, param_names = [], add_route, path_match, callback = Array.prototype.slice.call(arguments,2);
              
                    // if the method signature is just (path, callback)
                    // assume the verb is 'any'
              Severity: Minor
              Found in services/pisound/src/web/htdocs/js/sammy.js - About 1 hr to fix

                Function redirect has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    redirect: function() {
                      var to, args = _makeArray(arguments),
                          current_location = this.app.getLocation(),
                          l = args.length;
                      if (l > 1) {
                Severity: Minor
                Found in services/pisound/src/web/htdocs/js/sammy.js - About 1 hr to fix

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

                      run: function(start_url) {
                        if (this.isRunning()) { return false; }
                        var app = this;
                  
                        // actually bind all the listeners
                  Severity: Minor
                  Found in services/pisound/src/web/htdocs/js/sammy.js - About 1 hr to fix

                    Function EventContext has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      Sammy.EventContext = function(app, verb, path, params, target) {
                    Severity: Minor
                    Found in services/pisound/src/web/htdocs/js/sammy.js - About 35 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                    return location[0].innerHTML.toString();
                      Severity: Major
                      Found in services/pisound/src/web/htdocs/js/sammy.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return positive ? (verb_matched && path_matched) : !(verb_matched && path_matched);
                        Severity: Major
                        Found in services/pisound/src/web/htdocs/js/sammy.js - About 30 mins to fix

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                                $.each(this.listeners.toHash() , function(name, listeners) {
                                  $.each(listeners, function(i, listener_callback) {
                                    app._unlisten(name, listener_callback);
                                  });
                                });
                          Severity: Major
                          Found in services/pisound/src/web/htdocs/js/sammy.js and 1 other location - About 1 hr to fix
                          services/pisound/src/web/htdocs/js/sammy.js on lines 973..977

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 63.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                                $.each(this.listeners.toHash(), function(name, callbacks) {
                                  $.each(callbacks, function(i, listener_callback) {
                                    app._listen(name, listener_callback);
                                  });
                                });
                          Severity: Major
                          Found in services/pisound/src/web/htdocs/js/sammy.js and 1 other location - About 1 hr to fix
                          services/pisound/src/web/htdocs/js/sammy.js on lines 1021..1025

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 63.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              prependTo: function(selector) {
                                return this.then(function(content) {
                                  $(selector).prepend(content);
                                }).trigger('changed', {});
                              },
                          Severity: Major
                          Found in services/pisound/src/web/htdocs/js/sammy.js and 1 other location - About 1 hr to fix
                          services/pisound/src/web/htdocs/js/sammy.js on lines 1883..1887

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 55.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              appendTo: function(selector) {
                                return this.then(function(content) {
                                  $(selector).append(content);
                                }).trigger('changed', {});
                              },
                          Severity: Major
                          Found in services/pisound/src/web/htdocs/js/sammy.js and 1 other location - About 1 hr to fix
                          services/pisound/src/web/htdocs/js/sammy.js on lines 1890..1894

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 55.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              _listen: function(name, callback) {
                                return this.$element().bind([name, this.eventNamespace()].join('.'), callback);
                              },
                          Severity: Minor
                          Found in services/pisound/src/web/htdocs/js/sammy.js and 1 other location - About 40 mins to fix
                          services/pisound/src/web/htdocs/js/sammy.js on lines 1476..1478

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 49.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              _unlisten: function(name, callback) {
                                return this.$element().unbind([name, this.eventNamespace()].join('.'), callback);
                              }
                          Severity: Minor
                          Found in services/pisound/src/web/htdocs/js/sammy.js and 1 other location - About 40 mins to fix
                          services/pisound/src/web/htdocs/js/sammy.js on lines 1472..1474

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 49.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          There are no issues that match your filters.

                          Category
                          Status