dblock/slack-sup

View on GitHub

Showing 114 of 114 total issues

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

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

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

            def set_time(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 set_odd has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

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

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

            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

            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

            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

            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

                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

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

              $.fn.tooltip.noConflict = function () {
                $.fn.tooltip = 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 1866..1869

            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

            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 1359..1360

            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

            Avoid too many return statements within this function.
            Open

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

              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

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

                      def sort(coll, options = {})
                        sort_order = sort_order(options)
                        unless sort_order.empty?
                          if coll.respond_to?(:asc) && coll.respond_to?(:desc)
                            sort_order.each do |s|
                Severity: Minor
                Found in slack-sup/api/helpers/sort_helpers.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 set_day has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                        def set_day(client, team, data, user, v = nil)
                          if user.team_admin? && v
                            team.update_attributes(sup_wday: Date.parse(v).wday)
                            client.say(channel: data.channel, text: "Team S'Up is now on #{team.sup_day}.")
                          elsif v
                Severity: Minor
                Found in slack-sup/commands/set.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 set_custom_profile_team_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                        def set_custom_profile_team_field(client, team, data, user, v = nil)
                          if user.team_admin? && v
                            team.update_attributes!(team_field_label: v)
                            client.say(channel: data.channel, text: "Custom profile team field is now _#{team.team_field_label}_.")
                          elsif v
                Severity: Minor
                Found in slack-sup/commands/set.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 set_sync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                        def set_sync(client, team, data, user, v = nil)
                          if user.team_admin? && v
                            case v
                            when 'now' then
                              team.update_attributes!(sync: true)
                Severity: Minor
                Found in slack-sup/commands/set.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