oswaldlabs/chef-rundeck

View on GitHub

Showing 12 of 12 total issues

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

  def search(type, query='*:*', args={}, &block)
    raise ArgumentError, "Type must be a string or a symbol!" unless (type.kind_of?(String) || type.kind_of?(Symbol))

    sort = args.include?(:sort) ? args[:sort] : 'X_CHEF_id_CHEF_X asc'
    start = args.include?(:start) ? args[:start] : 0
Severity: Minor
Found in lib/partial_search.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 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 search has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def search(type, query='*:*', args={}, &block)
          raise ArgumentError, "Type must be a string or a symbol!" unless (type.kind_of?(String) || type.kind_of?(Symbol))
      
          sort = args.include?(:sort) ? args[:sort] : 'X_CHEF_id_CHEF_X asc'
          start = args.include?(:start) ? args[:start] : 0
      Severity: Minor
      Found in lib/partial_search.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

            Severity
            Category
            Status
            Source
            Language