BallAerospace/COSMOS

View on GitHub
cosmos/lib/cosmos/script/suite_runner.rb

Summary

Maintainability
D
2 days
Test Coverage

Method build_suites has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

    def self.build_suites
      @@suites = []
      # @@suites = @@suites.select { |my_suite| my_suite.name == 'CustomSuite' }
      suites = {}
      groups = []
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_runner.rb - About 1 day 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 start has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def self.start(suite_class, group_class = nil, script = nil)
      result = []
      execute('', suite_class, group_class, script) do |suite|
        if script
          result = suite.run_script(group_class, script)
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_runner.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 execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def self.execute(result_string, suite_class, group_class = nil, script = nil)
      @@suite_results = SuiteResults.new
      @@suites.each do |suite|
        if suite.class == suite_class
          @@suite_results.start(result_string, suite_class, group_class, script, @@settings)
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_runner.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 teardown has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.teardown(suite_class, group_class = nil)
      execute('Manual Teardown', suite_class, group_class) do |suite|
        if group_class
          result = suite.run_group_teardown(group_class)
        else
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_runner.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 setup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.setup(suite_class, group_class = nil)
      execute('Manual Setup', suite_class, group_class) do |suite|
        if group_class
          result = suite.run_group_setup(group_class)
        else
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_runner.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 open_struct_to_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.open_struct_to_hash(object)
      hash = object.to_h
      hash.each do |key1, val1|
        if val1.is_a?(Hash)
          val1.each do |key2, val2|
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_runner.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 2 locations. Consider refactoring.
Open

          when :GROUP_TEARDOWN
            cur_suite.groups[group_class.name] ||=
              OpenStruct.new(:setup => false, :teardown => false, :scripts => [])
            # Explicitly check for the teardown method and raise an error if it does not exist
            if group_class.method_defined?(:teardown)
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_runner.rb and 1 other location - About 35 mins to fix
cosmos/lib/cosmos/script/suite_runner.rb on lines 192..199

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

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

          when :GROUP_SETUP
            cur_suite.groups[group_class.name] ||=
              OpenStruct.new(:setup => false, :teardown => false, :scripts => [])
            # Explicitly check for the setup method and raise an error if it does not exist
            if group_class.method_defined?(:setup)
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_runner.rb and 1 other location - About 35 mins to fix
cosmos/lib/cosmos/script/suite_runner.rb on lines 201..208

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

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

    def self.setup(suite_class, group_class = nil)
      execute('Manual Setup', suite_class, group_class) do |suite|
        if group_class
          result = suite.run_group_setup(group_class)
        else
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_runner.rb and 1 other location - About 30 mins to fix
cosmos/lib/cosmos/script/suite_runner.rb on lines 89..98

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

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

    def self.teardown(suite_class, group_class = nil)
      execute('Manual Teardown', suite_class, group_class) do |suite|
        if group_class
          result = suite.run_group_teardown(group_class)
        else
Severity: Minor
Found in cosmos/lib/cosmos/script/suite_runner.rb and 1 other location - About 30 mins to fix
cosmos/lib/cosmos/script/suite_runner.rb on lines 75..84

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

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

There are no issues that match your filters.

Category
Status