Darep/Beatstream

View on GitHub

Showing 40 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

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

            componentWillUnmount: function() {
              App.Mediator.unsubscribe(MediatorEvents.AUDIO_DURATION_PARSED, this.setMax);
              App.Mediator.unsubscribe(MediatorEvents.AUDIO_TIME, this.updatePosition);
              App.Mediator.unsubscribe(MediatorEvents.AUDIO_STOPPED, this.stopSlider);
            },
          Severity: Major
          Found in app/assets/javascripts/components/seekbar.js.jsx and 2 other locations - About 2 hrs to fix
          app/assets/javascripts/components/player_time.js.jsx on lines 15..19
          app/assets/javascripts/components/player_time.js.jsx on lines 21..25

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 82.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

            componentDidMount: function () {
              App.Mediator.subscribe(MediatorEvents.AUDIO_DURATION_PARSED, this.updateDuration);
              App.Mediator.subscribe(MediatorEvents.AUDIO_TIME, this.updateElapsed);
              App.Mediator.subscribe(MediatorEvents.AUDIO_STOPPED, this.updateElapsed);
            },
          Severity: Major
          Found in app/assets/javascripts/components/player_time.js.jsx and 2 other locations - About 2 hrs to fix
          app/assets/javascripts/components/player_time.js.jsx on lines 21..25
          app/assets/javascripts/components/seekbar.js.jsx on lines 32..36

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 82.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

            componentWillUnmount: function() {
              App.Mediator.unsubscribe(MediatorEvents.AUDIO_DURATION_PARSED, this.updateDuration);
              App.Mediator.unsubscribe(MediatorEvents.AUDIO_TIME, this.updateElapsed);
              App.Mediator.unsubscribe(MediatorEvents.AUDIO_STOPPED, this.updateElapsed);
            },
          Severity: Major
          Found in app/assets/javascripts/components/player_time.js.jsx and 2 other locations - About 2 hrs to fix
          app/assets/javascripts/components/player_time.js.jsx on lines 15..19
          app/assets/javascripts/components/seekbar.js.jsx on lines 32..36

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 82.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  <button type="button" onClick={this.toggleRepeat} className={repeatClassName}>
                    <span className="player__toggle-button__label">Repeat</span>
                    <span className="player__toggle-button__status">{this.statusText('repeat')}</span>
                  </button>
          Severity: Major
          Found in app/assets/javascripts/components/player_options.js.jsx and 1 other location - About 2 hrs to fix
          app/assets/javascripts/components/player_options.js.jsx on lines 25..28

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 81.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  <button type="button" onClick={this.toggleShuffle} className={shuffleClassName}>
                    <span className="player__toggle-button__label">Shuffle</span>
                    <span className="player__toggle-button__status">{this.statusText('shuffle')}</span>
                  </button>
          Severity: Major
          Found in app/assets/javascripts/components/player_options.js.jsx and 1 other location - About 2 hrs to fix
          app/assets/javascripts/components/player_options.js.jsx on lines 21..24

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 81.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  var events = $.extend({
                      onPlay : function () {},
                      onPaused : function () {},
                      onSongEnd : function () {},
                      onTimeChange : function (elapsed_in_seconds) {},
          Severity: Major
          Found in app/assets/javascripts/audio-modules/html5audio.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/audio-modules/soundmanager2.js on lines 26..33

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 78.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  var events = $.extend({
                      onPlay : function () {},
                      onPaused : function () {},
                      onSongEnd : function () {},
                      onTimeChange : function (elapsed_in_seconds) {},
          Severity: Major
          Found in app/assets/javascripts/audio-modules/soundmanager2.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/audio-modules/html5audio.js on lines 10..17

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 78.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              scrobble: function(artist, title) {
                  var data = 'artist=' + encodeURIComponent(artist) + '&title=' + encodeURIComponent(title);
          
                  return this.ajax('/songs/scrobble', {
                      type: 'POST',
          Severity: Major
          Found in app/assets/javascripts/lib/api.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/lib/api.js on lines 87..95

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 64.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              updateNowPlaying: function(artist, title) {
                  var data = 'artist=' + encodeURIComponent(artist) + '&title=' + encodeURIComponent(title);
          
                  return this.ajax('/songs/now_playing', {
                      type: 'PUT',
          Severity: Major
          Found in app/assets/javascripts/lib/api.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/lib/api.js on lines 97..105

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 64.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          <div className="form-row form-row--inline">
                            <label>Email</label>
                            <input type="text" value={email} onChange={this.handleChange} />
                          </div>
          Severity: Major
          Found in app/assets/javascripts/components/settings_modal.js.jsx and 1 other location - About 1 hr to fix
          app/assets/javascripts/components/settings_modal.js.jsx on lines 34..37

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 61.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          <div className="form-row form-row--inline">
                            <label>Username</label>
                            <input type="text" value={username} onChange={this.handleChange} />
                          </div>
          Severity: Major
          Found in app/assets/javascripts/components/settings_modal.js.jsx and 1 other location - About 1 hr to fix
          app/assets/javascripts/components/settings_modal.js.jsx on lines 39..42

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 61.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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
              Severity
              Category
              Status
              Source
              Language