ManageIQ/active_bugzilla

View on GitHub

Showing 8 of 8 total issues

Class Service has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Service
    CLONE_FIELDS = [
      :assigned_to,
      :cc,
      :cf_devel_whiteboard,
Severity: Minor
Found in lib/active_bugzilla/service.rb - About 2 hrs to fix

    Method update_attributes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_attributes(attributes)
          attributes.delete(:id)
    
          attributes.each do |name, value|
            symbolized_name = name.to_sym
    Severity: Minor
    Found in lib/active_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 define_attributes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def define_attributes(names)
          define_attribute_methods names
    
          names.each do |name|
            next if name.to_s == 'flags'  # Flags is a special attribute
    Severity: Minor
    Found in lib/active_bugzilla/bug/service_management.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 find has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.find(options = {})
          options[:include_fields] ||= []
          options[:include_fields] << :id unless options[:include_fields].include?(:id)
    
          fields_to_include = options[:include_fields].dup
    Severity: Minor
    Found in lib/active_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 generate_xmlrpc_map has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate_xmlrpc_map
          hash = ATTRIBUTES_XMLRPC_RENAMES_MAP
          fields.each do |field|
            next if hash.values.include?(field.name)
            next if field.name.include?(".")
    Severity: Minor
    Found in lib/active_bugzilla/bug/service_management.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(attributes = {})
          attributes.each do |key, value|
            next unless attribute_names.include?(key)
            ivar_key = "@#{key}"
            instance_variable_set(ivar_key, value)
    Severity: Minor
    Found in lib/active_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 clone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def clone(bug_id, overrides = {})
          raise ArgumentError, "bug_id must be numeric" unless bug_id.to_s =~ /^\d+$/
    
          existing_bz = get(bug_id, :include_fields => CLONE_FIELDS).first
    
    
    Severity: Minor
    Found in lib/active_bugzilla/service.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 normalize_attributes_from_service has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def normalize_attributes_from_service(hash)
          attributes_xmlrpc_map.each do |bug_key, xmlrpc_key|
            next unless hash.key?(xmlrpc_key.to_s)
            value = hash.delete(xmlrpc_key.to_s)
            value = normalize_timestamp(value) if xmlrpc_timestamps.include?(xmlrpc_key)
    Severity: Minor
    Found in lib/active_bugzilla/bug/service_management.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