cyberbit/modation

View on GitHub

Showing 77 of 1,299 total issues

Avoid deeply nested control flow statements.
Open

                                        if (v.length) {
                                            // Notification not shown yet
                                            if (!notifData(id)) {
                                                chrome.notifications.create(id, notif, function() {
                                                    _updateData();
Severity: Major
Found in src/js/eventPage.js - About 45 mins to fix

Function showNotificationBar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function showNotificationBar(message, duration, bgColor, txtColor, height) {
    /*set default values*/
    fallbackHeight = 25;
    duration = typeof duration !== 'undefined' ? duration : 1500;
    bgColor = typeof bgColor !== 'undefined' ? bgColor : "#F4E0E1";
Severity: Minor
Found in src/js/options.js - 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

Function showNotificationBar has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function showNotificationBar(message, duration, bgColor, txtColor, height) {
    /*set default values*/
    fallbackHeight = 25;
    duration = typeof duration !== 'undefined' ? duration : 1500;
    bgColor = typeof bgColor !== 'undefined' ? bgColor : "#F4E0E1";
Severity: Minor
Found in src/js/newoptions.js - 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

Avoid deeply nested control flow statements.
Open

                                        if (metum.type == "track") {
                                            var likes = v.likes - current.likes;
                                            var downloads = v.downloads - current.downloads;
                                            var comments = v.comments - current.comments;
                                            
Severity: Major
Found in src/js/eventPage.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                                    if ($.inArray(link, messageLinks) != -1) return;
Severity: Major
Found in src/js/eventPage.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                                    if (global.debug) console.log("track %o: current %o, new %o", v.link, {
                                        likes: v.likes,
                                        downloads: v.downloads,
                                        comments: v.comments
                                    }, updates);
Severity: Major
Found in src/js/eventPage.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                                            if (numProcessed == changes.length) {
                                                // Update watchlist storage
                                                crapi.updateAll({watchlist: processed});
                                                
                                                // Update badge
Severity: Major
Found in src/js/eventPage.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                                else if (type == "group") {
                                    /**
                                     * Here, I'm using the hash of the comment body to determine if the top
                                     * comment is new. It's not ideal, but there is such variance in other
                                     * methods that I've decided to go this way. There are a few drawbacks:
Severity: Major
Found in src/js/eventPage.js - About 45 mins to fix

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

function showNotificationBar(message, duration, bgColor, txtColor, height) {
Severity: Minor
Found in src/js/options.js - About 35 mins to fix

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

function showNotificationBar(message, duration, bgColor, txtColor, height) {
Severity: Minor
Found in src/js/newoptions.js - About 35 mins to fix

Function parseHash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function parseHash() {
    if (location.hash === "") location.hash = "#general";
    if (location.hash === "#general") selectTab("tab-general");
    if (location.hash === "#storage") selectTab("tab-storage");
    if (location.hash === "#notifs") selectTab("tab-notifs");
Severity: Minor
Found in src/js/newoptions.js - About 35 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

Function parseHash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function parseHash() {
    if (location.hash === "") location.hash = "#general";
    if (location.hash === "#general") selectTab("tab-general");
    if (location.hash === "#storage") selectTab("tab-storage");
    if (location.hash === "#notifs") selectTab("tab-notifs");
Severity: Minor
Found in src/js/options.js - About 35 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

Avoid too many return statements within this function.
Open

    return {
      position: position,
      stem: stem
    };
Severity: Major
Found in src/js/opentip-jquery.custom.js - About 30 mins to fix

Function localJSON has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function localJSON(key, json) {
    if (typeof json == "undefined") {
        var value = localStorage[key];
        
        if (typeof value !== "undefined") {
Severity: Minor
Found in src/js/crapi.js - About 25 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

Function selectTab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function selectTab(id) {
    if (!$('[data-tab="' + id + '"]').is(".current")) {
        $('header .sub a').removeClass("current");
        $('[data-tab="' + id + '"]').addClass("current");
        $('.main-wrapper').hide();
Severity: Minor
Found in src/js/newoptions.js - About 25 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

Function selectTab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function selectTab(id) {
    if (!$('[data-tab="' + id + '"]').is(".current")) {
        $('header .sub a').removeClass("current");
        $('[data-tab="' + id + '"]').addClass("current");
        $('.main-wrapper').hide();
Severity: Minor
Found in src/js/options.js - About 25 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

Function setCss3Style has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Opentip.prototype.setCss3Style = function(element, styles) {
  var prop, value, vendor, vendorProp, _results;
  element = this.adapter.unwrap(element);
  _results = [];
  for (prop in styles) {
Severity: Minor
Found in src/js/opentip-jquery.custom.js - About 25 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