acaiafa/opentsdb-cookbook

View on GitHub
libraries/opentsdb_instance.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method action_enable has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def action_enable
        notifying_block do
          # Create user
          poise_service_user new_resource.user
          # Install Packages
Severity: Minor
Found in libraries/opentsdb_instance.rb - About 1 hr to fix

    Method action_enable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def action_enable
            notifying_block do
              # Create user
              poise_service_user new_resource.user
              # Install Packages
    Severity: Minor
    Found in libraries/opentsdb_instance.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

    Use file_cache_path rather than hard-coding tmp paths
    Open

              remote_file "#{new_resource.instance} :create opentsdb-#{new_resource.version}#{distro_ext}" do
    Severity: Minor
    Found in libraries/opentsdb_instance.rb by foodcritic

    This warning means that you have hard-coded a file download path in your cookbook to a temporary directory. This can be a problem on boxes built with a small /tmp mount point. Chef has its own configuration option file_cache_path you should use instead:

    Use 0o for octal literals.
    Open

                  mode 0644
    Severity: Minor
    Found in libraries/opentsdb_instance.rb by rubocop

    This cop checks for octal, hex, binary and decimal literals using uppercase prefixes and corrects them to lowercase prefix or no prefix (in case of decimals). eg. for octal use 0o instead of 0 or 0O.

    Can be configured to use 0 only for octal literals using EnforcedOctalStyle => zero_only

    There are no issues that match your filters.

    Category
    Status