cloudamatic/mu

View on GitHub
cookbooks/mu-glusterfs/recipes/server.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Avoid deeply nested control flow statements.
Open

            if type['level'] == node['glusterfs']['server']['raid_level'] and type['spare'] == node['glusterfs']['server']['raid_spare_vol'] and node['glusterfs']['server']['devices'].size >= type['min_devcies']
              raid_no_spare(node['glusterfs']['server']['raid_dev'], node['glusterfs']['server']['raid_level'], node['glusterfs']['server']['devices'].size, node['glusterfs']['server']['devices'].join(" "))
            end
Severity: Major
Found in cookbooks/mu-glusterfs/recipes/server.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if type['level'] == node['glusterfs']['server']['raid_level'] and type['spare'] == node['glusterfs']['server']['raid_spare_vol'] and node['glusterfs']['server']['devices'.size] >= type['min_devcies']
                  spare_device = node['glusterfs']['server']['devices'].pop
                  raid_with_spare(node['glusterfs']['server']['raid_dev'], node['glusterfs']['server']['raid_level'], node['glusterfs']['server']['devices'].size, node['glusterfs']['server']['devices'].join(" "), spare_device)
                end
    Severity: Major
    Found in cookbooks/mu-glusterfs/recipes/server.rb - About 45 mins to fix

      Avoid more than 4 levels of block nesting.
      Open

                  if type['level'] == node['glusterfs']['server']['raid_level'] and type['spare'] == node['glusterfs']['server']['raid_spare_vol'] and node['glusterfs']['server']['devices'.size] >= type['min_devcies']
                    spare_device = node['glusterfs']['server']['devices'].pop
                    raid_with_spare(node['glusterfs']['server']['raid_dev'], node['glusterfs']['server']['raid_level'], node['glusterfs']['server']['devices'].size, node['glusterfs']['server']['devices'].join(" "), spare_device)
                  end

      This cop checks for excessive nesting of conditional and looping constructs.

      You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

      The maximum level of nesting allowed is configurable.

      Avoid more than 4 levels of block nesting.
      Open

                  if type['level'] == node['glusterfs']['server']['raid_level'] and type['spare'] == node['glusterfs']['server']['raid_spare_vol'] and node['glusterfs']['server']['devices'].size >= type['min_devcies']
                    raid_no_spare(node['glusterfs']['server']['raid_dev'], node['glusterfs']['server']['raid_level'], node['glusterfs']['server']['devices'].size, node['glusterfs']['server']['devices'].join(" "))
                  end

      This cop checks for excessive nesting of conditional and looping constructs.

      You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

      The maximum level of nesting allowed is configurable.

      Do not compute the size of statically sized objects.
      Open

                  if type['level'] == node['glusterfs']['server']['raid_level'] and type['spare'] == node['glusterfs']['server']['raid_spare_vol'] and node['glusterfs']['server']['devices'.size] >= type['min_devcies']

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              bash "Set read cache max size on #{node['glusterfs']['server']['volume']}" do
                not_if "gluster volume info #{node['glusterfs']['server']['volume']} | grep 'performance.cache-size: #{node['glusterfs']['server']['read_cache_size']}'"
                code "gluster volume set #{node['glusterfs']['server']['volume']} performance.cache-size #{node['glusterfs']['server']['read_cache_size']}"
      Severity: Major
      Found in cookbooks/mu-glusterfs/recipes/server.rb and 1 other location - About 1 hr to fix
      cookbooks/mu-glusterfs/recipes/server.rb on lines 164..166

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

      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

              bash "Set network timeout on #{node['glusterfs']['server']['volume']}" do
                not_if "gluster volume info #{node['glusterfs']['server']['volume']} | grep 'network.ping-timeout: #{node['glusterfs']['server']['network_timeout']}'"
                code "gluster volume set #{node['glusterfs']['server']['volume']} network.ping-timeout #{node['glusterfs']['server']['network_timeout']}"
      Severity: Major
      Found in cookbooks/mu-glusterfs/recipes/server.rb and 1 other location - About 1 hr to fix
      cookbooks/mu-glusterfs/recipes/server.rb on lines 169..171

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

      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