keepcosmos/terjira

View on GitHub
lib/terjira/option_supportable.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Assignment Branch Condition size for suggest_options is too high. [42.94/20]
Open

    def suggest_options(opts = {})
      origin = options.dup
      self.with_editor = origin.delete(:editor)

      if opts[:required].is_a? Array
Severity: Minor
Found in lib/terjira/option_supportable.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for suggest_related_value_options is too high. [22.2/20]
Open

    def suggest_related_value_options(opts = {})
      if opts[:issuetype]
        if opts[:issuetype].key_value.casecmp('epic').zero?
          # Suggest epic name
          epic_name_field = Client::Field.epic_name
Severity: Minor
Found in lib/terjira/option_supportable.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method suggest_related_value_options has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def suggest_related_value_options(opts = {})
      if opts[:issuetype]
        if opts[:issuetype].key_value.casecmp('epic').zero?
          # Suggest epic name
          epic_name_field = Client::Field.epic_name
Severity: Minor
Found in lib/terjira/option_supportable.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 suggest_options has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def suggest_options(opts = {})
      origin = options.dup
      self.with_editor = origin.delete(:editor)

      if opts[:required].is_a? Array
Severity: Minor
Found in lib/terjira/option_supportable.rb - About 1 hr to fix

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

        def suggest_options(opts = {})
          origin = options.dup
          self.with_editor = origin.delete(:editor)
    
          if opts[:required].is_a? Array
    Severity: Minor
    Found in lib/terjira/option_supportable.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

    There are no issues that match your filters.

    Category
    Status