jcraigk/kudochest

View on GitHub

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

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

              function enterFullscreen() {
                $('#main').addClass('fullscreen-mode')
                $('#navbar').hide()
                $('#wallboard-options').hide()
                $('footer').hide()
            Severity: Major
            Found in app/webpacker/packs/wallboard.js and 1 other location - About 1 hr to fix
            app/webpacker/packs/wallboard.js on lines 49..54

            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

              function exitFullscreen() {
                $('#main').removeClass('fullscreen-mode')
                $('#navbar').show()
                $('#wallboard-options').show()
                $('footer').show()
            Severity: Major
            Found in app/webpacker/packs/wallboard.js and 1 other location - About 1 hr to fix
            app/webpacker/packs/wallboard.js on lines 42..47

            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

              def slack_inline_point_emojis
                "\n  * Type `#{PROF_PREFIX}[user]`#{team.point_emoj}, " \
                  "`#{PROF_PREFIX}[group]`#{team.point_emoj}, " \
                  "`#{CHAN_PREFIX}[channel]`#{team.point_emoj}, " \
                  "`#{PROF_PREFIX}channel`#{team.point_emoj}, " \
            Severity: Major
            Found in app/services/commands/help.rb and 1 other location - About 1 hr to fix
            app/services/commands/help.rb on lines 167..174

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

            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

              def slack_inline_jab_emojis
                "\n  * Type `#{PROF_PREFIX}[user]`#{team.jab_emoj}, " \
                  "`#{PROF_PREFIX}[group]`#{team.jab_emoj}, " \
                  "`#{CHAN_PREFIX}[channel]`#{team.jab_emoj}, " \
                  "`#{PROF_PREFIX}channel`#{team.jab_emoj}, " \
            Severity: Major
            Found in app/services/commands/help.rb and 1 other location - About 1 hr to fix
            app/services/commands/help.rb on lines 157..164

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

            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

            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

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

                def discord_jab_emojis
                  "\n  * Type `#{PROF_PREFIX}user`#{team.jab_emoj}, " \
                    "`#{PROF_PREFIX}role`#{team.jab_emoj}, " \
                    "`#{CHAN_PREFIX}channel`#{team.jab_emoj}, " \
                    "or `#{CHAN_PREFIX}everyone`#{team.jab_emoj} in a guild channel " \
              Severity: Minor
              Found in app/services/commands/help.rb and 1 other location - About 50 mins to fix
              app/services/commands/help.rb on lines 89..94

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

              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

                def discord_point_emojis
                  "\n  * Type `#{PROF_PREFIX}user`#{team.point_emoj}, " \
                    "`#{PROF_PREFIX}role`#{team.point_emoj}, " \
                    "`#{CHAN_PREFIX}channel`#{team.point_emoj}, " \
                    "or `#{CHAN_PREFIX}everyone`#{team.point_emoj} in a guild channel " \
              Severity: Minor
              Found in app/services/commands/help.rb and 1 other location - About 50 mins to fix
              app/services/commands/help.rb on lines 97..102

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

              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

              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

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

                def replace_user_mentions
                  @text = text.gsub(PROFILE_REGEX[platform]) do
                    if Regexp.last_match[3].present?
                      "#{PROF_PREFIX}#{Regexp.last_match[3]}"
                    else
              Severity: Minor
              Found in app/services/note_sanitizer.rb and 1 other location - About 20 mins to fix
              app/services/note_sanitizer.rb on lines 45..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 28.

              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

                def replace_channel_mentions
                  @text = text.gsub(CHANNEL_REGEX[platform]) do
                    if Regexp.last_match[3].present?
                      "#{CHAN_PREFIX}#{Regexp.last_match[3]}"
                    else
              Severity: Minor
              Found in app/services/note_sanitizer.rb and 1 other location - About 20 mins to fix
              app/services/note_sanitizer.rb on lines 33..38

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

              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