cyberbit/modation

View on GitHub

Showing 77 of 1,299 total issues

Function initStorage has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function initStorage() {
    var $tab = $("#tab-storage");
    var $copyBox = $(".storage-copy");
    var $confirm = $(".storage-confirm");
    
Severity: Major
Found in src/js/newoptions.js - About 2 hrs to fix

Function initStorage has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function initStorage() {
    var $tab = $("#tab-storage");
    var $copyBox = $(".storage-copy");
    var $confirm = $(".storage-confirm");
    
Severity: Major
Found in src/js/options.js - About 2 hrs to fix

Function initWatchlist has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function initWatchlist() {
        var link = global.path.home + location.pathname;
        
        // Request watchlist type
        chrome.runtime.sendMessage({action: "watchlistItemType", link: link}, function(result) {
Severity: Major
Found in src/js/content.js - About 2 hrs to fix

Function _loadAjax has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Opentip.prototype._loadAjax = function() {
    var ajaxCallback = this.options.ajaxCallback || function(d){return d};
    var _this = this;
    if (this.loading) {
      return;
Severity: Major
Found in src/js/opentip-jquery.custom.js - About 2 hrs to fix

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

  Opentip.prototype.show = function() {
    var _this = this;
    this._abortHiding();
    if (this.visible) {
      return;
Severity: Major
Found in src/js/opentip-jquery.custom.js - About 2 hrs to fix

Function _setupObservers has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Opentip.prototype._setupObservers = function() {
    var observeOrStop, removeObserver, state, states, trigger, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2,
      _this = this;
    states = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
    for (_i = 0, _len = states.length; _i < _len; _i++) {
Severity: Major
Found in src/js/opentip-jquery.custom.js - About 2 hrs to fix

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

    function initNotifs() {
        //Click handler
        chrome.notifications.onClicked.addListener(function(notifId) {
            var data = notifData(notifId);
            
Severity: Major
Found in src/js/eventPage.js - About 2 hrs to fix

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

  Opentip.prototype._setup = function() {
    var hideOn, hideTrigger, hideTriggerElement, i, _i, _j, _len, _len1, _ref, _ref1, _results;
    this.debug("Setting up the tooltip.");
    this._buildContainer();
    this.hideTriggers = [];
Severity: Minor
Found in src/js/opentip-jquery.custom.js - About 2 hrs to fix

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

  Opentip.prototype.hide = function() {
    var _this = this;
    this._abortShowing();
    if (!this.visible) {
      return;
Severity: Minor
Found in src/js/opentip-jquery.custom.js - About 1 hr to fix

Function parseWatchlist has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function parseWatchlist() {
    //Show loader
    $("#modation-watchlist .loader").show();
    
    crapi.clone(function(d) {        
Severity: Minor
Found in src/js/popup.js - About 1 hr to fix

Function findElements has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

Opentip.findElements = function() {
  var adapter, content, element, optionName, optionValue, options, _i, _len, _ref, _results;
  adapter = Opentip.adapter;
  _ref = adapter.findAll(document.body, "[data-ot]");
  _results = [];
Severity: Minor
Found in src/js/opentip-jquery.custom.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 _updateView has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                    (function _updateView() {
                        // Use ~ trick to convert index result into coerced boolean
                        // (see http://stackoverflow.com/a/12299678)
                        var watched = ~watchedIndex;
                        
Severity: Minor
Found in src/js/content.js - About 1 hr to fix

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

CrAPI.prototype.tests.storageTest1 = function(next) {
    console.groupCollapsed("Test Chrome storage functions");
    try {
        var _this = this;
        
Severity: Minor
Found in src/js/crapi.js - About 1 hr to fix

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

CrAPI.prototype.tests.storageTest2 = function(next) {
    console.groupCollapsed("Test CrAPI storage functions");
    try {
        var _this = this;
        
Severity: Minor
Found in src/js/crapi.js - About 1 hr to fix

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

    function initUpdate(details) {
        //console.log("initUpdate: %o", details);
        
        // Clone storage
        crapi.clone($.extend(true, {}, global.storageModel, {options: global.optionDefaults}), function(d) {
Severity: Minor
Found in src/js/eventPage.js - About 1 hr to fix

Function preinit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function preinit() {
    $.get(chrome.extension.getURL("content.html"), function(d) {
        $("body").append(d);
        
        crapi.clone(function(d) {
Severity: Minor
Found in src/js/content.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 getCursorPosition has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        getCursorPosition : function() {
            var element = input = this[0];
            var value = (input.value || input.innerText)

            if(!this.data("lastCursorPosition")){
Severity: Minor
Found in src/js/jquery.caretposition.custom.js - About 1 hr to fix

Function _generateAlerts has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                    function _generateAlerts() {
                        //var watchlistAlerts = data['watchlist-queue'].length;
                        var alerts = feedAlerts;// + watchlistAlerts;
                        var alertString = "";
                        
Severity: Minor
Found in src/js/popup.js - About 1 hr to fix

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

function refresh_watchlist() {
    var email = $('#email').val();
    
    crapi.clone(function(d) {        
        var watchlist = d[email]["watchlist"] || {};
Severity: Minor
Found in src/js/options.js - About 1 hr to fix

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

function initNav() {
    var $pageLinks = $("nav.main [data-page]");
    var $tabGroups = $("nav.inner[data-page]");
    var $contentGroups = $("main .inner[data-page]");
    
Severity: Minor
Found in src/js/newoptions.js - About 1 hr to fix
Severity
Category
Status
Source
Language