hummingbird-me/hummingbird

View on GitHub

Showing 419 of 859 total issues

Avoid too many return statements within this method.
Open

    return "Great"    if r == 8
Severity: Major
Found in app/helpers/reviews_helper.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return pluralize(difference_in_months, "month")
    Severity: Major
    Found in app/helpers/application_helper.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return "Amazing"  if r == 9
      Severity: Major
      Found in app/helpers/reviews_helper.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return "Good"     if r == 7
        Severity: Major
        Found in app/helpers/reviews_helper.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return "Decent"   if r == 6
          Severity: Major
          Found in app/helpers/reviews_helper.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return render(text: "Unknown error: #{e.message}", status: 400)
            Severity: Major
            Found in app/controllers/pro_memberships_controller.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return 'Finished Airing'
              Severity: Major
              Found in app/models/anime.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return pluralize(difference_in_years, "year")
                Severity: Major
                Found in app/helpers/application_helper.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                      return "Flawless" if r == 10
                  Severity: Major
                  Found in app/helpers/reviews_helper.rb - About 30 mins to fix

                    Function needsClick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    FastClick.prototype.needsClick = function(target) {
                        'use strict';
                        switch (target.nodeName.toLowerCase()) {
                    
                        // Don't send a synthetic click to disabled inputs (issue #62)
                    Severity: Minor
                    Found in public/2014/assets/js/fastclick.js - 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

                    Function willDestroyElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      willDestroyElement: function() {
                        var ui = this.get('ui');
                    
                        if (ui) {
                          // Tear down any observers that were created to make jQuery UI
                    Severity: Minor
                    Found in app/assets/javascripts/mixins/JQueryMixin.js - 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

                    Function needsClick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    FastClick.prototype.needsClick = function(target) {
                        'use strict';
                        switch (target.nodeName.toLowerCase()) {
                    
                        // Don't send a synthetic click to disabled inputs (issue #62)
                    Severity: Minor
                    Found in public/2013/assets/js/fastclick.js - 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

                    Method ed_serialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def ed_serialize(data, options = {})
                        data = data.to_a if data.respond_to? :to_ary
                        data = [data] unless data.is_a? Array
                        return if data.empty?
                        options[:scope] = current_user
                    Severity: Minor
                    Found in app/controllers/application_controller.rb - 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

                    Method perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def perform(user_id, story_id)
                        story = Story.find_by_id(story_id)
                        user = User.find(user_id)
                        return if story.nil?
                    
                    
                    Severity: Minor
                    Found in app/workers/story_fanout_worker.rb - 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

                    Method renew! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def renew!(attempt_number: 0)
                        token = @user.stripe_token
                        plan = @user.pro_membership_plan
                    
                        unless plan.recurring?
                    Severity: Minor
                    Found in app/services/pro_membership_manager.rb - 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

                    Method status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def status
                        # If the started_airing_date is in the future or not specified,
                        # the show hasn't aired yet.
                        if started_airing_date.nil? || started_airing_date > Time.zone.now.to_date
                          return 'Not Yet Aired'
                    Severity: Minor
                    Found in app/models/anime.rb - 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

                    Method show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def show
                        notification = Notification.find_by_id(params[:id])
                        if notification.nil? or notification.user != current_user
                          redirect_to :back
                        else
                    Severity: Minor
                    Found in app/controllers/notifications_controller.rb - 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

                    Method index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def index
                        params.permit(:user_id, :group_id, :news_feed, :page)
                    
                        if params[:user_id]
                          user = User.find(params[:user_id])
                    Severity: Minor
                    Found in app/controllers/stories_controller.rb - 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

                    Method find_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def find_user(id)
                          begin
                            if id == "me" and user_signed_in?
                              current_user
                            else
                    Severity: Minor
                    Found in app/api/api_v1.rb - 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