sumoheavy/jira-ruby

View on GitHub

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

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

                  if params.key?(:issuetypeIds)
                    values = Array(params[:issuetypeIds]).map { |i| (i.is_a?(JIRA::Resource::Issuetype) ? i.id : i) }
                    params[:issuetypeIds] = values.join(',')
          Severity: Minor
          Found in lib/jira/resource/createmeta.rb and 3 other locations - About 20 mins to fix
          lib/jira/resource/createmeta.rb on lines 12..14
          lib/jira/resource/createmeta.rb on lines 17..19
          lib/jira/resource/createmeta.rb on lines 22..24

          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 4 locations. Consider refactoring.
          Open

                  if params.key?(:projectKeys)
                    values = Array(params[:projectKeys]).map { |i| (i.is_a?(JIRA::Resource::Project) ? i.key : i) }
                    params[:projectKeys] = values.join(',')
          Severity: Minor
          Found in lib/jira/resource/createmeta.rb and 3 other locations - About 20 mins to fix
          lib/jira/resource/createmeta.rb on lines 17..19
          lib/jira/resource/createmeta.rb on lines 22..24
          lib/jira/resource/createmeta.rb on lines 27..29

          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 4 locations. Consider refactoring.
          Open

                  if params.key?(:projectIds)
                    values = Array(params[:projectIds]).map { |i| (i.is_a?(JIRA::Resource::Project) ? i.id : i) }
                    params[:projectIds] = values.join(',')
          Severity: Minor
          Found in lib/jira/resource/createmeta.rb and 3 other locations - About 20 mins to fix
          lib/jira/resource/createmeta.rb on lines 12..14
          lib/jira/resource/createmeta.rb on lines 22..24
          lib/jira/resource/createmeta.rb on lines 27..29

          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