visioncritical/consul_template

View on GitHub

Showing 6 of 49 total issues

Method binary_checksum has 198 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.binary_checksum(node, resource)
        tag = node['kernel']['machine'] =~ /x86_64/ ? 'amd64' : '386'
        case [node['os'], tag].join('-')
        when 'darwin-i386'
          case resource.version
Severity: Major
Found in libraries/consul_template_installation_binary.rb - About 7 hrs to fix

    Method binary_checksum has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.binary_checksum(node, resource)
            tag = node['kernel']['machine'] =~ /x86_64/ ? 'amd64' : '386'
            case [node['os'], tag].join('-')
            when 'darwin-i386'
              case resource.version
    Severity: Minor
    Found in libraries/consul_template_installation_binary.rb - About 4 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

    File consul_template_installation_binary.rb has 269 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'poise'
    require_relative './helpers'
    require_relative './nssm_helpers'
    
    module ConsulTemplateCookbook
    Severity: Minor
    Found in libraries/consul_template_installation_binary.rb - About 2 hrs to fix

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

            def action_enable
              notifying_block do
                directories = %W(#{new_resource.data_dir}
                                 #{::File.dirname(new_resource.nssm_params['AppStdout'])}
                                 #{::File.dirname(new_resource.nssm_params['AppStderr'])}).uniq.compact
      Severity: Minor
      Found in libraries/consul_template_service_windows.rb - About 1 hr to fix

        Method nssm_params has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def nssm_params
              %w(Application
                 AppParameters
                 AppDirectory
                 AppExit
        Severity: Minor
        Found in libraries/nssm_helpers.rb - About 1 hr to fix

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

                def action_enable
                  notifying_block do
                    directories = %W(#{new_resource.data_dir}
                                     #{::File.dirname(new_resource.nssm_params['AppStdout'])}
                                     #{::File.dirname(new_resource.nssm_params['AppStderr'])}).uniq.compact
          Severity: Minor
          Found in libraries/consul_template_service_windows.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

          Severity
          Category
          Status
          Source
          Language