BallAerospace/COSMOS

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

Summary

Maintainability
F
4 days
Test Coverage

Method run_group has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    def run_group(group_class, internal = false, &block)
      ScriptResult.suite = name() unless internal

      # Determine if this group_class is in the plan and the number of scripts associated with this group_class
      in_plan = false
Severity: Minor
Found in cosmos/lib/cosmos/script/suite.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 run has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    def run(&block)
      ScriptResult.suite = name()
      ScriptStatus.instance.total = get_num_scripts()
      results = []

Severity: Minor
Found in cosmos/lib/cosmos/script/suite.rb - About 7 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 run_method has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    def run_method(object, method_name)
      # Convert to a symbol to use as a method_name
      method_name = method_name.to_s.intern unless method_name.class == Symbol

      result = ScriptResult.new
Severity: Minor
Found in cosmos/lib/cosmos/script/suite.rb - About 5 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 run has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      results = []

      # Setup the script group
      result = run_setup()
Severity: Minor
Found in cosmos/lib/cosmos/script/suite.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 run_setup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def run_setup(internal = false)
      ScriptResult.suite = name() unless internal
      result = nil
      if self.class.method_defined?(:setup) and @scripts.length > 0
        ScriptStatus.instance.total = 1 unless internal
Severity: Minor
Found in cosmos/lib/cosmos/script/suite.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 run_teardown has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def run_teardown(internal = false)
      ScriptResult.suite = name() unless internal
      result = nil
      if self.class.method_defined?(:teardown) and @scripts.length > 0
        ScriptStatus.instance.total = 1 unless internal
Severity: Minor
Found in cosmos/lib/cosmos/script/suite.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

Avoid deeply nested control flow statements.
Open

                yield result if block_given?
Severity: Major
Found in cosmos/lib/cosmos/script/suite.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    yield result if block_given?
    Severity: Major
    Found in cosmos/lib/cosmos/script/suite.rb - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if (plan_type == :GROUP_SETUP and group_class == plan_group_class) or
                 (plan_type == :GROUP_TEARDOWN and group_class == plan_group_class) or
                 (plan_script and group_class == plan_group_class)
                num_scripts += 1
              end
      Severity: Major
      Found in cosmos/lib/cosmos/script/suite.rb - About 40 mins to fix

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

            def run_script(group_class, script, internal = false)
              ScriptResult.suite = name() unless internal
              ScriptStatus.instance.total = 1 unless internal
              result = @scripts[group_class].run_script(script)
              ScriptResult.suite = nil unless internal
        Severity: Minor
        Found in cosmos/lib/cosmos/script/suite.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 run_group_teardown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def run_group_teardown(group_class, internal = false)
              ScriptResult.suite = name() unless internal
              ScriptStatus.instance.total = 1 unless internal
              result = @scripts[group_class].run_teardown
              ScriptResult.suite = nil unless internal
        Severity: Minor
        Found in cosmos/lib/cosmos/script/suite.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 run_group_setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def run_group_setup(group_class, internal = false)
              ScriptResult.suite = name() unless internal
              ScriptStatus.instance.total = 1 unless internal
              result = @scripts[group_class].run_setup
              ScriptResult.suite = nil unless internal
        Severity: Minor
        Found in cosmos/lib/cosmos/script/suite.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

            def run_setup(internal = false)
              ScriptResult.suite = name() unless internal
              result = nil
              if self.class.method_defined?(:setup) and @scripts.length > 0
                ScriptStatus.instance.total = 1 unless internal
        Severity: Major
        Found in cosmos/lib/cosmos/script/suite.rb and 1 other location - About 1 hr to fix
        cosmos/lib/cosmos/script/suite.rb on lines 233..242

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

        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 run_teardown(internal = false)
              ScriptResult.suite = name() unless internal
              result = nil
              if self.class.method_defined?(:teardown) and @scripts.length > 0
                ScriptStatus.instance.total = 1 unless internal
        Severity: Major
        Found in cosmos/lib/cosmos/script/suite.rb and 1 other location - About 1 hr to fix
        cosmos/lib/cosmos/script/suite.rb on lines 221..230

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

        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
                  result = run_group_setup(group_class, true)
                  if result
                    results << result
                    yield result if block_given?
        Severity: Minor
        Found in cosmos/lib/cosmos/script/suite.rb and 1 other location - About 20 mins to fix
        cosmos/lib/cosmos/script/suite.rb on lines 135..141

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

            def add_group_setup(group_class)
              group_class = Object.const_get(group_class.to_s.intern) unless group_class.class == Class
              @scripts[group_class] = group_class.new unless @scripts[group_class]
              @plans << [:GROUP_SETUP, group_class, nil]
        Severity: Minor
        Found in cosmos/lib/cosmos/script/suite.rb and 2 other locations - About 20 mins to fix
        cosmos/lib/cosmos/script/suite.rb on lines 44..47
        cosmos/lib/cosmos/script/suite.rb on lines 65..68

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

            def add_group_teardown(group_class)
              group_class = Object.const_get(group_class.to_s.intern) unless group_class.class == Class
              @scripts[group_class] = group_class.new unless @scripts[group_class]
              @plans << [:GROUP_TEARDOWN, group_class, nil]
        Severity: Minor
        Found in cosmos/lib/cosmos/script/suite.rb and 2 other locations - About 20 mins to fix
        cosmos/lib/cosmos/script/suite.rb on lines 44..47
        cosmos/lib/cosmos/script/suite.rb on lines 58..61

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

            def add_group(group_class)
              group_class = Object.const_get(group_class.to_s.intern) unless group_class.class == Class
              @scripts[group_class] = group_class.new unless @scripts[group_class]
              @plans << [:GROUP, group_class, nil]
        Severity: Minor
        Found in cosmos/lib/cosmos/script/suite.rb and 2 other locations - About 20 mins to fix
        cosmos/lib/cosmos/script/suite.rb on lines 58..61
        cosmos/lib/cosmos/script/suite.rb on lines 65..68

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

                when :GROUP_TEARDOWN
                  result = run_group_teardown(group_class, true)
                  if result
                    results << result
                    yield result if block_given?
        Severity: Minor
        Found in cosmos/lib/cosmos/script/suite.rb and 1 other location - About 20 mins to fix
        cosmos/lib/cosmos/script/suite.rb on lines 128..134

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

            def run_group_teardown(group_class, internal = false)
              ScriptResult.suite = name() unless internal
              ScriptStatus.instance.total = 1 unless internal
              result = @scripts[group_class].run_teardown
              ScriptResult.suite = nil unless internal
        Severity: Minor
        Found in cosmos/lib/cosmos/script/suite.rb and 1 other location - About 15 mins to fix
        cosmos/lib/cosmos/script/suite.rb on lines 245..250

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

        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 run_group_setup(group_class, internal = false)
              ScriptResult.suite = name() unless internal
              ScriptStatus.instance.total = 1 unless internal
              result = @scripts[group_class].run_setup
              ScriptResult.suite = nil unless internal
        Severity: Minor
        Found in cosmos/lib/cosmos/script/suite.rb and 1 other location - About 15 mins to fix
        cosmos/lib/cosmos/script/suite.rb on lines 253..258

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

        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