jcraigk/kudochest

View on GitHub

Showing 10 of 18 total issues

Function exports has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(api) {
  var validEnv = ['development', 'test', 'production']
  var currentEnv = api.env()
  var isDevelopmentEnv = api.env('development')
  var isProductionEnv = api.env('production')
Severity: Major
Found in babel.config.js - About 3 hrs to fix

    Class TipService has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Image::TipService < Base::ImageService
      option :fragments
      option :tips
    
      WIDTH = 500
    Severity: Minor
    Found in app/services/image/tip_service.rb - About 2 hrs to fix

      Method add_body has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def add_body(comp) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
          draw = Magick::Draw.new
          draw.font = FONT_FILE
          draw.gravity = Magick::NorthWestGravity
      
      
      Severity: Major
      Found in app/services/image/leaderboard_service.rb - About 2 hrs to fix

        Class Help has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Commands::Help < Commands::Base
          def call
            ChatResponse.new(mode: :private, text: send("#{team.platform}_text"))
          end
        
        
        Severity: Minor
        Found in app/services/commands/help.rb - About 2 hrs to fix

          Method add_body_text has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def add_body_text(comp)
              body_width = WIDTH - 100
              body_height = 57
              text_width = body_width + 1
              text_height = body_height + 1
          Severity: Minor
          Found in app/services/image/tip_service.rb - About 1 hr to fix

            Method add_body_text has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def add_body_text(comp)
                body_width = WIDTH - 100
                body_height = 57
                text_width = body_width + 1
                text_height = body_height + 1
            Severity: Minor
            Found in app/services/image/tip_service.rb - 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

            Method add_from_or_channel_text has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def add_from_or_channel_text(comp)
                # Channel
                if config[:show_channel]
                  channel_name = "#{CHAN_PREFIX}#{first_tip.from_channel_name}"
            
            
            Severity: Minor
            Found in app/services/image/tip_service.rb - About 1 hr to fix

              Method base_text has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def base_text # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
                  ary = [stats_title]
                  ary << rank_fragment
                  ary << level_fragment if team.enable_levels?
                  ary << points_received_fragment
              Severity: Minor
              Found in app/services/commands/stats.rb - About 45 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 add_body has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def add_body(comp) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
                  draw = Magick::Draw.new
                  draw.font = FONT_FILE
                  draw.gravity = Magick::NorthWestGravity
              
              
              Severity: Minor
              Found in app/services/image/leaderboard_service.rb - About 45 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 group_label has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def group_label(tip)
                  return 'Everyone' if tip.to_everyone
                  if (chan = tip.to_channel_name).present?
                    str = "##{chan}"
                    return tip.to_here? ? "#{str} [here]" : str
              Severity: Minor
              Found in app/helpers/application_helper.rb - About 35 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