vpereira/bugzilla

View on GitHub

Showing 23 of 23 total issues

Method prehook has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

      def prehook(*args)
        cmd, opts, *etc = args
        case cmd
        when :search
          # This parameter is Red Hat Extension
Severity: Minor
Found in lib/bugzilla/plugins/rhbugzilla.rb - About 6 hrs 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 posthook has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

      def posthook(*args)
        cmd, opts, *etc = args
        case cmd
        when :search
          if opts.include?('bugs')
Severity: Minor
Found in lib/bugzilla/plugins/rhbugzilla.rb - About 5 hrs 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 prehook has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def prehook(*args)
        cmd, opts, *etc = args
        case cmd
        when :search
          # This parameter is Red Hat Extension
Severity: Major
Found in lib/bugzilla/plugins/rhbugzilla.rb - About 4 hrs to fix

    Method get_bugs has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_bugs(bugs, fields = FIELDS_SUMMARY)
          params = {}
    
          params['ids'] = case bugs
                          when Array
    Severity: Minor
    Found in lib/bugzilla/bug.rb - About 2 hrs 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 _get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get(cmd, ids, *_args)
          # This is still in experimental and apparently the behavior was changed since 4.2.
          # We don't keep the backward-compatibility and just require the proper version here.
          requires_version(cmd, 4.2)
    
    
    Severity: Minor
    Found in lib/bugzilla/product.rb - About 2 hrs 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 _create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def _create(cmd, *args)
          raise ArgumentError, 'Invalid parameters' unless args[0].is_a?(Hash)
    
          required_fields = %i[product component summary version]
          defaulted_fields = %i[description op_sys platform priority severity]
    Severity: Minor
    Found in lib/bugzilla/bug.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 posthook has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def posthook(*args)
            cmd, opts, *etc = args
            case cmd
            when :search
              if opts.include?('bugs')
    Severity: Minor
    Found in lib/bugzilla/plugins/rhbugzilla.rb - About 1 hr to fix

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

                if opts.include?('bugs')
                  opts['bugs'].each do |bug|
                    if bug.include?('bug_status')
                      bug['status'] = bug['bug_status']
                      bug.delete('bug_status')
      Severity: Major
      Found in lib/bugzilla/plugins/rhbugzilla.rb and 1 other location - About 1 hr to fix
      lib/bugzilla/plugins/rhbugzilla.rb on lines 165..181

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

      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 opts.include?('bugs')
                  opts['bugs'].each do |bug|
                    if bug.include?('bug_status')
                      bug['status'] = bug['bug_status']
                      bug.delete('bug_status')
      Severity: Major
      Found in lib/bugzilla/plugins/rhbugzilla.rb and 1 other location - About 1 hr to fix
      lib/bugzilla/plugins/rhbugzilla.rb on lines 188..204

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

      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 _get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get(cmd, _args)
            requires_version(cmd, 4.4)
      
            params = {}
            # TODO
      Severity: Minor
      Found in lib/bugzilla/classification.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 get_userinfo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_userinfo(user)
            p = {}
            ids = []
            names = []
      
      
      Severity: Minor
      Found in lib/bugzilla/user.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 get_bugs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def get_bugs(bugs, fields = FIELDS_SUMMARY)
            params = {}
      
            params['ids'] = case bugs
                            when Array
      Severity: Minor
      Found in lib/bugzilla/bug.rb - About 1 hr to fix

        Method call has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def call(cmd, params = {}, user = nil, password = nil)
              params = {} if params.nil?
              params['Bugzilla_login'] = user unless user.nil? || password.nil?
              params['Bugzilla_password'] = password unless user.nil? || password.nil?
              params['Bugzilla_token'] = @token unless @token.nil?
        Severity: Minor
        Found in lib/bugzilla/xmlrpc.rb - About 55 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 get_comments has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_comments(bugs)
              params = {}
        
              # TODO
              # this construction should be refactored to a method
        Severity: Minor
        Found in lib/bugzilla/bug.rb - About 55 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 session has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def session(user, password)
              key, fname = authentication_method
        
              # TODO
              # make those variables available
        Severity: Minor
        Found in lib/bugzilla/user.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 get_proxy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_proxy(info)
              uri = info[:Proxy] || ENV['http_proxy']
              proxy_uri = uri.nil? ? nil : URI.parse(uri)
              proxy_host = proxy_uri.nil? ? nil : proxy_uri.host
              proxy_port = proxy_uri.nil? ? nil : proxy_uri.port
        Severity: Minor
        Found in lib/bugzilla/utils.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def run(hook, host, *args)
                @@plugins.each do |k|
                  i = k.new
                  next unless i.hostname == host || host.nil?
        
        
        Severity: Minor
        Found in lib/bugzilla/plugin.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 _fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _fields(cmd, *args)
              requires_version(cmd, 3.6)
              params = {}
              a = args[0]
              case a
        Severity: Minor
        Found in lib/bugzilla/bug.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 read_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def read_config(opts)
              fname = opts[:config].nil? ? @defaultyamlfile : opts[:config]
              begin
                # TODO: fix config file
                # Psych doesnt allow Symbol as class
        Severity: Minor
        Found in lib/bugzilla/utils.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

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

              case a
              when Hash
                params = a
              when Array
                params['ids'] = a
        Severity: Minor
        Found in lib/bugzilla/bug.rb and 1 other location - About 20 mins to fix
        lib/bugzilla/bug.rb on lines 287..295

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

        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