sumoheavy/jira-ruby

View on GitHub

Showing 17 of 24 total issues

Class Base has 42 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Base
    QUERY_PARAMS_FOR_SINGLE_FETCH = Set.new %i[expand fields]
    QUERY_PARAMS_FOR_SEARCH = Set.new %i[expand fields startAt maxResults]

    # A reference to the JIRA::Client used to initialize this resource.
Severity: Minor
Found in lib/jira/base.rb - About 5 hrs to fix

    Class Client has 41 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Client
        extend Forwardable
    
        # The OAuth::Consumer instance returned by the OauthClient
        #
    Severity: Minor
    Found in lib/jira/client.rb - About 5 hrs to fix

      Method all has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.all(client, params = {})
              if params.key?(:projectKeys)
                values = Array(params[:projectKeys]).map { |i| (i.is_a?(JIRA::Resource::Project) ? i.key : i) }
                params[:projectKeys] = values.join(',')
              end
      Severity: Minor
      Found in lib/jira/resource/createmeta.rb - About 3 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

      File base.rb has 266 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'active_support/core_ext/string'
      require 'active_support/inflector'
      require 'set'
      
      module JIRA
      Severity: Minor
      Found in lib/jira/base.rb - About 2 hrs to fix

        Method initialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(options = {})
              options = DEFAULT_OPTIONS.merge(options)
              @options = options
              @options[:rest_base_path] = @options[:context_path] + @options[:rest_base_path]
        
        
        Severity: Minor
        Found in lib/jira/client.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 initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def initialize(options = {})
              options = DEFAULT_OPTIONS.merge(options)
              @options = options
              @options[:rest_base_path] = @options[:context_path] + @options[:rest_base_path]
        
        
        Severity: Minor
        Found in lib/jira/client.rb - About 1 hr to fix

          Method map_fields has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.map_fields(client)
                  field_map = {}
                  field_map_reverse = {}
                  fields = client.Field.all
          
          
          Severity: Minor
          Found in lib/jira/resource/field.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 maybe_nested_attribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.maybe_nested_attribute(attributes, attribute_name, nested_under = nil)
                return attributes[attribute_name] if nested_under.nil?
                if nested_under.instance_of? Array
                  final = nested_under.inject(attributes) do |parent, key|
                    break if parent.nil?
          Severity: Minor
          Found in lib/jira/base.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 jql has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.jql(client, jql, options = { fields: nil, start_at: nil, max_results: nil, expand: nil, validate_query: true })
                  url = client.options[:rest_base_path] + "/search?jql=#{CGI.escape(jql)}"
          
                  url << "&fields=#{options[:fields].map { |value| CGI.escape(client.Field.name_to_id(value)) }.join(',')}" if options[:fields]
                  url << "&startAt=#{CGI.escape(options[:start_at].to_s)}" if options[:start_at]
          Severity: Minor
          Found in lib/jira/resource/issue.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 method_missing has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def method_missing(method_name, *args, &block)
                  if attrs.key?('fields')
                    if attrs['fields'].key?(method_name.to_s)
                      attrs['fields'][method_name.to_s]
                    else
          Severity: Minor
          Found in lib/jira/resource/issue.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 rapidview_id has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def rapidview_id
                  return @attrs['rapidview_id'] if @attrs['rapidview_id']
                  search_url = client.options[:site] + '/secure/GHGoToBoard.jspa?sprintId=' + id.to_s
                  begin
                    response = client.get(search_url)
          Severity: Minor
          Found in lib/jira/resource/sprint.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 set_attrs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def set_attrs(hash, clobber = true, target = nil)
                target ||= @attrs
                if clobber
                  target.merge!(hash)
                  hash
          Severity: Minor
          Found in lib/jira/base.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 url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def url
                prefix = '/'
                unless self.class.belongs_to_relationships.empty?
                  prefix = self.class.belongs_to_relationships.inject(prefix) do |prefix_so_far, relationship|
                    prefix_so_far.to_s + relationship.to_s + '/' + send("#{relationship}_id").to_s + '/'
          Severity: Minor
          Found in lib/jira/base.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 get_sprint_details has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def get_sprint_details
                  search_url =
                    "#{client.options[:site]}#{client.options[:client_path]}/rest/greenhopper/1.0/rapid/charts/sprintreport?rapidViewId=#{rapidview_id}&sprintId=#{id}"
                  begin
                    response = client.get(search_url)
          Severity: Minor
          Found in lib/jira/resource/sprint.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 fetch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def fetch(reload = false, query_params = {})
                  return if expanded? && !reload
                  response = client.get(url_with_query_params(url, query_params))
                  set_attrs_from_response(response)
                  if @attrs && @attrs['fields'] && @attrs['fields']['worklog'] && (@attrs['fields']['worklog']['total'] > @attrs['fields']['worklog']['maxResults'])
          Severity: Minor
          Found in lib/jira/resource/issue.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize(client, options = {})
                @client   = client
                @attrs    = options[:attrs] || {}
                @expanded = options[:expanded] || false
                @deleted  = false
          Severity: Minor
          Found in lib/jira/base.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 http_conn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def http_conn(uri)
                http_conn =
                  if @options[:proxy_address]
                    Net::HTTP.new(uri.host, uri.port, @options[:proxy_address], @options[:proxy_port] || 80, @options[:proxy_username], @options[:proxy_password])
                  else
          Severity: Minor
          Found in lib/jira/http_client.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