Darep/Beatstream

View on GitHub

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 },
Severity: Major
Found in app/assets/javascripts/songlist.js - About 1 day to fix

    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,
    Severity: Minor
    Found in app/assets/javascripts/lib/utils.js - About 4 hrs 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 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,
    Severity: Major
    Found in app/assets/javascripts/lib/utils.js - About 3 hrs to fix

      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
      Severity: Minor
      Found in app/assets/javascripts/songlist.js - About 3 hrs to fix

        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);
        Severity: Major
        Found in app/assets/javascripts/components/settings_modal.js.jsx - About 2 hrs to fix

          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)) {
          Severity: Minor
          Found in app/assets/javascripts/lib/utils.js - About 2 hrs 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 play has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              AudioModule.prototype.play = function (uri) {
                  if (!soundManagerIsReady) {
                      return;
                  }
          
          
          Severity: Minor
          Found in app/assets/javascripts/audio-modules/soundmanager2.js - About 1 hr to fix

            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);
            
            
            Severity: Minor
            Found in app/assets/javascripts/lib/jquery_onenter.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 AudioModule has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function AudioModule(events_in) {
                    var audio = $('<audio />');
                    
                    var events = $.extend({
                        onPlay : function () {},
            Severity: Minor
            Found in app/assets/javascripts/audio-modules/html5audio.js - About 1 hr to fix

              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()) {
              Severity: Minor
              Found in app/assets/javascripts/components/player.js.jsx - About 1 hr to fix

                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;
                Severity: Minor
                Found in app/assets/javascripts/components/main.js.jsx - About 1 hr to fix

                  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;
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/songlist.js - About 1 hr to fix

                    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' })`
                    Severity: Minor
                    Found in app/assets/javascripts/lib/api.js - About 55 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

                    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;
                    Severity: Major
                    Found in app/assets/javascripts/songlist.js - About 40 mins to fix

                      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
                      Severity: Minor
                      Found in app/assets/javascripts/components/user_panel.js.jsx - 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