dblock/slack-sup

View on GitHub

Showing 124 of 124 total issues

Method unset has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def unset(client, team, data, user, k)
Severity: Minor
Found in slack-sup/commands/set.rb - About 35 mins to fix

    Method set_recency has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def set_recency(client, team, data, user, v = nil)
    Severity: Minor
    Found in slack-sup/commands/set.rb - About 35 mins to fix

      Method set_weeks has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def set_weeks(client, team, data, user, v = nil)
      Severity: Minor
      Found in slack-sup/commands/set.rb - About 35 mins to fix

        Method set_message has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def set_message(client, team, data, user, v = nil)
        Severity: Minor
        Found in slack-sup/commands/set.rb - About 35 mins to fix

          Method set_custom_profile_team_field has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def set_custom_profile_team_field(client, team, data, user, v = nil)
          Severity: Minor
          Found in slack-sup/commands/set.rb - About 35 mins to fix

            Method set_day has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def set_day(client, team, data, user, v = nil)
            Severity: Minor
            Found in slack-sup/commands/set.rb - About 35 mins to fix

              Method set_followup_day has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      def set_followup_day(client, team, data, user, v = nil)
              Severity: Minor
              Found in slack-sup/commands/set.rb - About 35 mins to fix

                Method rotate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        def rotate(client, team, data, user, k)
                Severity: Minor
                Found in slack-sup/commands/set.rb - About 35 mins to fix

                  Method solve_remaining has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def solve_remaining(remaining_users)
                      if remaining_users.count == 1
                        # find a sup to add this user to
                        sups.each do |sup|
                          next if met_recently?(sup.users + remaining_users)
                  Severity: Minor
                  Found in slack-sup/models/round.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

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

                      def sup!
                        invoke! do |team|
                          last_round_at = team.last_round_at
                          logger.info "Checking whether to sup #{team}, #{last_round_at ? 'last round ' + last_round_at.ago_in_words : 'first time sup'}."
                          next unless team.sup?
                  Severity: Minor
                  Found in slack-sup/app.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

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

                      def check_expired_subscriptions!
                        Team.active.where(subscribed: false).each do |team|
                          logger.info "Checking #{team} created #{team.created_at.ago_in_words}, subscription #{team.subscription_expired? ? 'has expired' : 'is active'}."
                          next unless team.subscription_expired?
                  
                  
                  Severity: Minor
                  Found in slack-sup/app.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

                  Method unset_api_token has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def unset_api_token(client, team, data, user)
                            if !team.api?
                              set_api(client, team, data, user)
                            elsif user.team_admin? && team.api_token
                              team.update_attributes!(api_token: nil)
                  Severity: Minor
                  Found in slack-sup/commands/set.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

                  Method set_timezone has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def set_timezone(client, team, data, user, v = nil)
                            if user.team_admin? && v
                              timezone = ActiveSupport::TimeZone.new(v)
                              raise SlackSup::Error, "TimeZone _#{v}_ is invalid, see https://github.com/rails/rails/blob/v#{ActiveSupport.gem_version}/activesupport/lib/active_support/values/time_zone.rb#L30 for a list. Team S'Up timezone is currently #{team.sup_tzone}." unless timezone
                  
                  
                  Severity: Minor
                  Found in slack-sup/commands/set.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

                  Method set_message has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def set_message(client, team, data, user, v = nil)
                            if user.team_admin? && v
                              team.update_attributes!(sup_message: v.to_s)
                              client.say(channel: data.channel, text: "Now using a custom S'Up message. _#{team.sup_message}_")
                            elsif v && team.sup_message
                  Severity: Minor
                  Found in slack-sup/commands/set.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

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

                      if (!selector) {
                        selector = $this.attr('href')
                        selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
                      }
                  Severity: Minor
                  Found in public/js/bootstrap.js and 1 other location - About 35 mins to fix
                  public/js/bootstrap.js on lines 2076..2079

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

                  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

                      if (!selector) {
                        selector = $this.attr('href')
                        selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
                      }
                  Severity: Minor
                  Found in public/js/bootstrap.js and 1 other location - About 35 mins to fix
                  public/js/bootstrap.js on lines 107..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 46.

                  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

                  Avoid too many return statements within this function.
                  Open

                      if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
                  Severity: Major
                  Found in public/js/bootstrap.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return false
                    Severity: Major
                    Found in public/js/bootstrap.js - About 30 mins to fix

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

                          var self = obj instanceof this.constructor ?
                            obj : $(obj.currentTarget).data('bs.' + this.type)
                      Severity: Minor
                      Found in public/js/bootstrap.js and 1 other location - About 30 mins to fix
                      public/js/bootstrap.js on lines 1396..1397

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

                      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

                        $.fn.popover.noConflict = function () {
                          $.fn.popover = old
                          return this
                        }
                      Severity: Minor
                      Found in public/js/bootstrap.js and 1 other location - About 30 mins to fix
                      public/js/bootstrap.js on lines 1757..1760

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

                      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