aeolusproject/conductor

View on GitHub
src/app/helpers/mustache_helper.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

  def image_for_mustache(image)
    last_rebuild = I18n.l(Time.at(image.last_built_image_version.created_at.to_f)) rescue ''
    os = image.template ? image.template.os : nil

    result = {
Severity: Minor
Found in src/app/helpers/mustache_helper.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 pool_for_mustache has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def pool_for_mustache(pool)
    pool_statistics = pool.statistics
    user_can_access_pool_family =
      check_privilege(Alberich::Privilege::VIEW, pool.pool_family)

Severity: Minor
Found in src/app/helpers/mustache_helper.rb - About 1 hr to fix

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

      def deployment_for_mustache(deployment)
        {
          :id                   => deployment.id,
          :name                 => deployment.name,
          :path                 => deployment_path(deployment),
    Severity: Minor
    Found in src/app/helpers/mustache_helper.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 instance_for_mustache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def instance_for_mustache(instance)
        available_actions = instance.get_action_list
    
        {
          :id       => instance.id,
    Severity: Minor
    Found in src/app/helpers/mustache_helper.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