hummingbird-me/hummingbird

View on GitHub

Showing 859 of 859 total issues

Function FastClick has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

function FastClick(layer) {
    'use strict';
    var oldOnClick, self = this;


Severity: Minor
Found in public/2014/assets/js/fastclick.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

Method apply_filters has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def apply_filters(anime)
    anime = anime.full_search(name) unless name.nil?
    anime = anime.where(slug: id) unless id.nil?
    anime = anime.where(show_type: show_type) unless show_type.nil?
    anime = anime.by_genres(genres) unless genres.nil?
Severity: Minor
Found in app/services/anime_search.rb - 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

Method present_story has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def present_story(story, current_user, title_language_preference)
      json = {
        id: story.id,
        story_type: story.story_type,
        user: present_miniuser(story.user),
Severity: Minor
Found in app/api/api_v1.rb - 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 _open has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _open: function( event, target, content ) {
        var tooltip, events, delayedShow,
            positionOption = $.extend( {}, this.options.position );

        if ( !content ) {
Severity: Major
Found in app/assets/javascripts/old/jquery-ui-custom-1.10.3.js - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        } else if (typeof options == 'object' || !options) {
    
          // Check if any options were passed
          var settings = $.extend({
              checkedClass: _checked,
    Severity: Critical
    Found in app/assets/javascripts/old/jquery.icheck.js - About 2 hrs to fix

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

        saveLibraryEntry: function (libraryEntry) {
          var title;
          title = libraryEntry.get('anime.canonicalTitle');
          return Messenger().expectPromise((function () {
            return libraryEntry.save();
      Severity: Major
      Found in frontend/app/controllers/user/library.js and 1 other location - About 2 hrs to fix
      frontend/app/controllers/user/manga-library.js on lines 101..110

      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 88.

      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

        saveMangaLibraryEntry: function (libraryEntry) {
          var title;
          title = libraryEntry.get('manga.romajiTitle');
          return Messenger().expectPromise((function () {
            return libraryEntry.save();
      Severity: Major
      Found in frontend/app/controllers/user/manga-library.js and 1 other location - About 2 hrs to fix
      frontend/app/controllers/user/library.js on lines 103..112

      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 88.

      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

            this.element
              .find('option')
              .each(function() {
                if(!this.disabled && $.inArray(this.value, values) > -1) {
                  self._toggleState('selected', flag).call(this);
      Severity: Major
      Found in app/assets/javascripts/old/multiselect.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/old/multiselect-filter.js on lines 81..85

      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 88.

      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

              this.element.find('option').filter(function() {
                if(!this.disabled && $.inArray(this.value, values) > -1) {
                  _self._toggleState('selected', flag).call(this);
                }
              });
      Severity: Major
      Found in app/assets/javascripts/old/multiselect-filter.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/old/multiselect.js on lines 503..509

      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 88.

      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

                  this.element.siblings( ":visible" ).each(function() {
                      var elem = $( this ),
                          position = elem.css( "position" );
      
                      if ( position === "absolute" || position === "fixed" ) {
      Severity: Major
      Found in app/assets/javascripts/old/jquery-ui-custom-1.10.3.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/old/jquery-ui-custom-1.10.3.js on lines 11987..11995

      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 87.

      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

                  this.element.siblings( ":visible" ).each(function() {
                      var elem = $( this ),
                          position = elem.css( "position" );
      
                      if ( position === "absolute" || position === "fixed" ) {
      Severity: Major
      Found in app/assets/javascripts/old/jquery-ui-custom-1.10.3.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/old/jquery-ui-custom-1.10.3.js on lines 5566..5574

      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 87.

      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

          toggleFavorite: function() {
            if (!this.get('currentUser.isSignedIn')){
              alert('Need to be signed in');
              return;
            }
      Severity: Major
      Found in frontend/app/routes/anime/index.js and 1 other location - About 2 hrs to fix
      frontend/app/routes/manga/index.js on lines 41..50

      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 87.

      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

          toggleFavorite: function() {
            if (!this.get('currentUser.isSignedIn')) {
              alert('Need to be signed in');
              return;
            }
      Severity: Major
      Found in frontend/app/routes/manga/index.js and 1 other location - About 2 hrs to fix
      frontend/app/routes/anime/index.js on lines 61..70

      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 87.

      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 AwesomeRating has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      $.fn.AwesomeRating = function(options) {
        return this.each(function() {
          var i, icon, rating, widget, _i, _len, _ref, _results;
          widget = this;
          rating = $(widget).attr("data-rating");
      Severity: Minor
      Found in app/assets/javascripts/old/awesome_rating.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 notNeeded has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      FastClick.notNeeded = function(layer) {
          'use strict';
          var metaViewport;
          var chromeVersion;
      
      
      Severity: Minor
      Found in public/2014/assets/js/fastclick.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 notNeeded has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      FastClick.notNeeded = function(layer) {
          'use strict';
          var metaViewport;
          var chromeVersion;
      
      
      Severity: Minor
      Found in public/2013/assets/js/fastclick.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

      Method filter_old has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def filter_old
          hide_cover_image
          @filter_years = %w(Upcoming 2010s 2000s 1990s 1980s 1970s Older)
      
          if params[:g]
      Severity: Major
      Found in app/controllers/anime_controller.rb - About 2 hrs to fix

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

              {
                "name": "HummingList",
                "author": [
                  { "name": "Riddle", "link": "http://hummingbird.me/users/riddle" },
                ],
        Severity: Major
        Found in frontend/app/routes/apps/index.js and 3 other locations - About 2 hrs to fix
        frontend/app/routes/apps/index.js on lines 12..25
        frontend/app/routes/apps/index.js on lines 68..81
        frontend/app/routes/apps/index.js on lines 138..151

        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 86.

        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 4 locations. Consider refactoring.
        Open

              {
                "name": "That Li'l Hummingbird",
                "author": [
                  { "name": "ThatLilChestnut", "link": "https://hummingbird.me/users/ThatLilChestnut" }
                ],
        Severity: Major
        Found in frontend/app/routes/apps/index.js and 3 other locations - About 2 hrs to fix
        frontend/app/routes/apps/index.js on lines 12..25
        frontend/app/routes/apps/index.js on lines 26..39
        frontend/app/routes/apps/index.js on lines 68..81

        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 86.

        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 4 locations. Consider refactoring.
        Open

              {
                "name": "Imprint",
                "author": [
                  { "name": "Tempest", "link": "http://hummingbird.me/users/Tempest" },
                ],
        Severity: Major
        Found in frontend/app/routes/apps/index.js and 3 other locations - About 2 hrs to fix
        frontend/app/routes/apps/index.js on lines 26..39
        frontend/app/routes/apps/index.js on lines 68..81
        frontend/app/routes/apps/index.js on lines 138..151

        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 86.

        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

        Severity
        Category
        Status
        Source
        Language