oswaldlabs/chef-rundeck

View on GitHub
lib/chef-rundeck.rb

Summary

Maintainability
D
1 day
Test Coverage

Method configure has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def configure
      Chef::Config.from_file(ChefRundeck.config_file)
      Chef::Log.level = Chef::Config[:log_level]

      unless ChefRundeck.api_url
Severity: Minor
Found in lib/chef-rundeck.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 build_project has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def build_project (project="default", pattern="*:*", username=ChefRundeck.username, hostname="fqdn", custom_attributes=nil)
    response = nil
    begin

      # file is too new use it again
Severity: Major
Found in lib/chef-rundeck.rb - About 2 hrs to fix

    Method convert_results has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def convert_results(results, hostname, custom_attributes)
     new_results = []
     results.each do |node|
       n = {}
       n['name'] = node.name
    Severity: Minor
    Found in lib/chef-rundeck.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 build_project has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def build_project (project="default", pattern="*:*", username=ChefRundeck.username, hostname="fqdn", custom_attributes=nil)
        response = nil
        begin
    
          # file is too new use it again
    Severity: Minor
    Found in lib/chef-rundeck.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 partial_search has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def partial_search(type, query='*:*', *args, &block)
      # Support both the old (positional args) and new (hash args) styles of calling
      if args.length == 1 && args[0].is_a?(Hash)
        args_hash = args[0]
      else
    Severity: Minor
    Found in lib/chef-rundeck.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 node_is_valid? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def node_is_valid?(node)
      raise ArgumentError, "#{node} missing 'name'" if !node['name']
      raise ArgumentError, "#{node} missing 'chef_environment'" if !node['chef_environment']
      raise ArgumentError, "#{node} missing 'run_list'" if !node['run_list']
      raise ArgumentError, "#{node} missing 'recipes'" if !node['recipes']
    Severity: Minor
    Found in lib/chef-rundeck.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 build_node has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def build_node (node, username, hostname, custom_attributes)
          #--
          # Certain features in Rundeck require the osFamily value to be set to 'unix' to work appropriately. - SRK
          #++
          data = ''
    Severity: Minor
    Found in lib/chef-rundeck.rb - About 1 hr to fix

      Method configure has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def configure
            Chef::Config.from_file(ChefRundeck.config_file)
            Chef::Log.level = Chef::Config[:log_level]
      
            unless ChefRundeck.api_url
      Severity: Minor
      Found in lib/chef-rundeck.rb - About 1 hr to fix

        Method build_project has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def build_project (project="default", pattern="*:*", username=ChefRundeck.username, hostname="fqdn", custom_attributes=nil)
        Severity: Minor
        Found in lib/chef-rundeck.rb - About 35 mins to fix

          Method build_node has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def build_node (node, username, hostname, custom_attributes)
                #--
                # Certain features in Rundeck require the osFamily value to be set to 'unix' to work appropriately. - SRK
                #++
                data = ''
          Severity: Minor
          Found in lib/chef-rundeck.rb - About 35 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