Showing 14 of 20 total issues
File livereload.js
has 973 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
(function() {
var __customevents = {}, __protocol = {}, __connector = {}, __timer = {}, __options = {}, __reloader = {}, __livereload = {}, __less = {}, __startup = {};
// customevents
var CustomEvents;
Function LiveReload
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function LiveReload(window) {
var _this = this;
this.window = window;
this.listeners = {};
this.plugins = [];
Function reloadStylesheet
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
File web_socket.js
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
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
Function __initialize
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
WebSocket.__initialize = function() {
if (WebSocket.__flash) return;
if (WebSocket.__swfLocation) {
// For backword compatibility.
Function process
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Parser.prototype.process = function(data) {
var command, message, options, _ref;
try {
if (!(this.protocol != null)) {
if (data.match(/^!!ver:([\d.]+)$/)) {
Function Connector
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Connector(options, WebSocket, Timer, handlers) {
var _this = this;
this.options = options;
this.WebSocket = WebSocket;
this.Timer = Timer;
Function reattachStylesheetLink
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Reloader.prototype.reattachStylesheetLink = function(link) {
var clone, parent,
_this = this;
if (link.__LiveReload_pendingRemoval) {
return;
Function reattachImportedRule
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Function reloadImages
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
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++) {
Function waitUntilCssLoads
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Reloader.prototype.waitUntilCssLoads = function(clone, func) {
var callbackExecuted, executeCallback, poll,
_this = this;
callbackExecuted = false;
executeCallback = function() {
Function reload
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Avoid deeply nested control flow statements. Open
Open
if ((keyAndValue = pair.split('=')).length > 1) {
options.set(keyAndValue[0].replace(/-/g, '_'), keyAndValue.slice(1).join('='));
}
Method _call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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)
- Read upRead up
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"