Showing 15 of 40 total issues
Function initializeSlickGrid
has 248 lines of code (exceeds 25 allowed). Consider refactoring. Open
Songlist.prototype.initializeSlickGrid = function (events) {
var initDone = false;
var columns = [
{ id: 'np', resizable: false, width: 22 },
Function pretty_number
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function pretty_number(num, opts) {
var defaultOpts = {
short: true,
lowerCase: false,
addCommas: true,
- 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"
Further reading
Function pretty_number
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
function pretty_number(num, opts) {
var defaultOpts = {
short: true,
lowerCase: false,
addCommas: true,
File songlist.js
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
//= require jquery.cookie
//= require lib/utils
//= require lib/key_codes
//= require lib/mediator
//= require dragtooltip
Function render
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var user = this.props.user;
var username = user.username;
var email = user.email || '';
var lastfmConnected = (user.lastfm_session_key && user.lastfm_username);
Function naturalsort
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function naturalsort(a, b) {
function chunkify(t) {
var tz = [], x = 0, y = -1, n = 0, i, j;
while (i = (j = t.charAt(x++)).charCodeAt(0)) {
- 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"
Further reading
Function play
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
AudioModule.prototype.play = function (uri) {
if (!soundManagerIsReady) {
return;
}
Function onEnter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
jQuery.fn.onEnter = function(callback) {
return this.each(function () {
$(this).keyup(function (e) {
var code = (e.keyCode ? e.keyCode : e.which);
- 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"
Further reading
Function AudioModule
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AudioModule(events_in) {
var audio = $('<audio />');
var events = $.extend({
onPlay : function () {},
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var songlist = this.props.songlist;
var playPause = function () {
if (!songlist.isPlaying()) {
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var user = this.props.user;
var songs = this.props.songs;
var count = this.props.songs.length;
var songlist = this.props.songlist;
Function nextSong
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
grid.nextSong = function (shuffle, repeat, manual) {
var number_of_rows = grid.getDataLength();
var new_row = 0;
var current_row = -1;
Function ajax
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ajax: function () {
var url, args;
/**
Parse arguments. Supports e.g. `ajax('/some-uri', { type: 'GET' })`
- 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"
Further reading
Consider simplifying this complex logical expression. Open
if ((item.title && item.title.toLowerCase().indexOf(str) != -1) ||
(item.artist && item.artist.toLowerCase().indexOf(str) != -1) ||
(item.album && item.album.toLowerCase().indexOf(str) != -1))
{
match = true;
Function pageClick
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
pageClick: function (e) {
var match = false;
if (!this.state.open) {
// Not open, do nothing
- 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"