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();
- Create a ticketCreate a ticket
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";
- Read upRead up
- Create a ticketCreate a ticket
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";
- Read upRead up
- Create a ticketCreate a ticket
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;
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if ($.inArray(link, messageLinks) != -1) return;
- Create a ticketCreate a ticket
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);
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (numProcessed == changes.length) {
// Update watchlist storage
crapi.updateAll({watchlist: processed});
// Update badge
- Create a ticketCreate a ticket
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:
- Create a ticketCreate a ticket
Function showNotificationBar
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function showNotificationBar(message, duration, bgColor, txtColor, height) {
- Create a ticketCreate a ticket
Function showNotificationBar
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function showNotificationBar(message, duration, bgColor, txtColor, height) {
- Create a ticketCreate a ticket
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");
- Read upRead up
- Create a ticketCreate a ticket
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");
- Read upRead up
- Create a ticketCreate a ticket
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
};
- Create a ticketCreate a ticket
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") {
- Read upRead up
- Create a ticketCreate a ticket
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();
- Read upRead up
- Create a ticketCreate a ticket
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();
- Read upRead up
- Create a ticketCreate a ticket
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) {
- Read upRead up
- Create a ticketCreate a ticket
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"