johnbintz/rack-livereload

View on GitHub

Showing 14 of 20 total issues

File livereload.js has 973 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function() {
var __customevents = {}, __protocol = {}, __connector = {}, __timer = {}, __options = {}, __reloader = {}, __livereload = {}, __less = {}, __startup = {};

// customevents
var CustomEvents;
Severity: Major
Found in js/livereload.js - About 2 days to fix

    Function LiveReload has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function LiveReload(window) {
        var _this = this;
        this.window = window;
        this.listeners = {};
        this.plugins = [];
    Severity: Major
    Found in js/livereload.js - About 2 hrs to fix

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

          Reloader.prototype.reloadStylesheet = function(path) {
            var imported, link, links, match, style, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1,
              _this = this;
            links = (function() {
              var _i, _len, _ref, _results;
      Severity: Major
      Found in js/livereload.js - About 2 hrs to fix

        File web_socket.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
        // License: New BSD License
        // Reference: http://dev.w3.org/html5/websockets/
        // Reference: http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10
        
        
        Severity: Minor
        Found in js/web_socket.js - About 2 hrs to fix

          Function __initialize has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            WebSocket.__initialize = function() {
              if (WebSocket.__flash) return;
              
              if (WebSocket.__swfLocation) {
                // For backword compatibility.
          Severity: Minor
          Found in js/web_socket.js - About 1 hr to fix

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

              Parser.prototype.process = function(data) {
                var command, message, options, _ref;
                try {
                  if (!(this.protocol != null)) {
                    if (data.match(/^!!ver:([\d.]+)$/)) {
            Severity: Minor
            Found in js/livereload.js - About 1 hr to fix

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

                function Connector(options, WebSocket, Timer, handlers) {
                  var _this = this;
                  this.options = options;
                  this.WebSocket = WebSocket;
                  this.Timer = Timer;
              Severity: Minor
              Found in js/livereload.js - About 1 hr to fix

                Function reattachStylesheetLink has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    Reloader.prototype.reattachStylesheetLink = function(link) {
                      var clone, parent,
                        _this = this;
                      if (link.__LiveReload_pendingRemoval) {
                        return;
                Severity: Minor
                Found in js/livereload.js - About 1 hr to fix

                  Function reattachImportedRule has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      Reloader.prototype.reattachImportedRule = function(_arg) {
                        var href, index, link, media, newRule, parent, rule, tempLink,
                          _this = this;
                        rule = _arg.rule, index = _arg.index, link = _arg.link;
                        parent = rule.parentStyleSheet;
                  Severity: Minor
                  Found in js/livereload.js - About 1 hr to fix

                    Function reloadImages has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        Reloader.prototype.reloadImages = function(path) {
                          var expando, img, selector, styleNames, styleSheet, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3, _results;
                          expando = this.generateUniqueString();
                          _ref = this.document.images;
                          for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                    Severity: Minor
                    Found in js/livereload.js - About 1 hr to fix

                      Function waitUntilCssLoads has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          Reloader.prototype.waitUntilCssLoads = function(clone, func) {
                            var callbackExecuted, executeCallback, poll,
                              _this = this;
                            callbackExecuted = false;
                            executeCallback = function() {
                      Severity: Minor
                      Found in js/livereload.js - About 1 hr to fix

                        Function reload has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            Reloader.prototype.reload = function(path, options) {
                              var plugin, _base, _i, _len, _ref;
                              this.options = options;
                              if ((_base = this.options).stylesheetReloadTimeout == null) {
                                _base.stylesheetReloadTimeout = 15000;
                        Severity: Minor
                        Found in js/livereload.js - About 1 hr to fix

                          Avoid deeply nested control flow statements.
                          Open

                                    if ((keyAndValue = pair.split('=')).length > 1) {
                                      options.set(keyAndValue[0].replace(/-/g, '_'), keyAndValue.slice(1).join('='));
                                    }
                          Severity: Major
                          Found in js/livereload.js - About 45 mins to fix

                            Method _call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def _call(env)
                                  _, path, file = (env['PATH_INFO'] || '').split('/')
                            
                                  if path == '__rack' && ::File.file?(target = ::File.expand_path("../../../js/#{file}", __FILE__))
                                    deliver_file(target)
                            Severity: Minor
                            Found in lib/rack/livereload.rb - About 45 mins 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

                            Severity
                            Category
                            Status
                            Source
                            Language