saltstack/salt

View on GitHub
salt/modules/consul.py

Summary

Maintainability
F
1 mo
Test Coverage

File consul.py has 1920 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Interact with Consul

https://www.consul.io
Severity: Major
Found in salt/modules/consul.py - About 5 days to fix

    Function catalog_register has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    def catalog_register(consul_url=None, token=None, **kwargs):
        '''
        Registers a new node, service, or check
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py - About 1 day 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

    Function put has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    def put(consul_url=None, token=None, key=None, value=None, **kwargs):
        '''
        Put values into Consul
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py - About 6 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

    Function agent_service_register has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    def agent_service_register(consul_url=None, token=None, **kwargs):
        '''
        The used to add a new service, with an optional
        health check, to the local agent.
    
    
    Severity: Minor
    Found in salt/modules/consul.py - About 5 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

    Cyclomatic complexity is too high in function catalog_register. (35)
    Open

    def catalog_register(consul_url=None, token=None, **kwargs):
        '''
        Registers a new node, service, or check
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function session_create has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def session_create(consul_url=None, token=None, **kwargs):
        '''
        Used to create a session.
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py - 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

    Function get has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def get(consul_url=None, key=None, token=None, recurse=False, decode=False, raw=False):
        '''
        Get key from Consul
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py - 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

    Function agent_check_register has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def agent_check_register(consul_url=None, token=None, **kwargs):
        '''
        The register endpoint is used to add a new check to the local agent.
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py - 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

    Cyclomatic complexity is too high in function put. (23)
    Open

    def put(consul_url=None, token=None, key=None, value=None, **kwargs):
        '''
        Put values into Consul
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function agent_service_register. (22)
    Open

    def agent_service_register(consul_url=None, token=None, **kwargs):
        '''
        The used to add a new service, with an optional
        health check, to the local agent.
    
    
    Severity: Minor
    Found in salt/modules/consul.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function _query has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def _query(function,
               consul_url,
               token=None,
               method='GET',
               api_version='v1',
    Severity: Minor
    Found in salt/modules/consul.py - 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

    Function acl_update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def acl_update(consul_url=None, token=None, **kwargs):
        '''
        Update an ACL token.
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py - 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

    Function delete has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def delete(consul_url=None, token=None, key=None, **kwargs):
        '''
        Delete values from Consul
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py - 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

    Function catalog_register has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def catalog_register(consul_url=None, token=None, **kwargs):
        '''
        Registers a new node, service, or check
    
        :param consul_url: The Consul server URL.
    Severity: Minor
    Found in salt/modules/consul.py - About 1 hr to fix

      Function event_fire has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def event_fire(consul_url=None, token=None, name=None, **kwargs):
          '''
          List the ACL tokens.
      
          :param consul_url: The Consul server URL.
      Severity: Minor
      Found in salt/modules/consul.py - 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

      Function catalog_deregister has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def catalog_deregister(consul_url=None, token=None, **kwargs):
          '''
          Deregisters a node, service, or check
      
          :param consul_url: The Consul server URL.
      Severity: Minor
      Found in salt/modules/consul.py - 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

      Function acl_create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def acl_create(consul_url=None, token=None, **kwargs):
          '''
          Create a new ACL token.
      
          :param consul_url: The Consul server URL.
      Severity: Minor
      Found in salt/modules/consul.py - About 55 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

      Function agent_service_maintenance has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def agent_service_maintenance(consul_url=None, token=None, serviceid=None, **kwargs):
          '''
          Used to place a service into maintenance mode.
      
          :param consul_url: The Consul server URL.
      Severity: Minor
      Found in salt/modules/consul.py - About 55 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

      Function agent_maintenance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def agent_maintenance(consul_url=None, token=None, **kwargs):
          '''
          Manages node maintenance mode
      
          :param consul_url: The Consul server URL.
      Severity: Minor
      Found in salt/modules/consul.py - 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

      Function agent_join has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def agent_join(consul_url=None, token=None, address=None, **kwargs):
          '''
          Triggers the local agent to join a node
      
          :param consul_url: The Consul server URL.
      Severity: Minor
      Found in salt/modules/consul.py - 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

      Function session_destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def session_destroy(consul_url=None, token=None, session=None, **kwargs):
          '''
          Destroy session
      
          :param consul_url: The Consul server URL.
      Severity: Minor
      Found in salt/modules/consul.py - 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

      Function agent_check_warn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def agent_check_warn(consul_url=None, token=None, checkid=None, **kwargs):
          '''
          This endpoint is used with a check that is of the TTL type. When this
          is called, the status of the check is set to warning and the TTL
          clock is reset.
      Severity: Minor
      Found in salt/modules/consul.py - 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

      Function session_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def session_list(consul_url=None, token=None, return_list=False, **kwargs):
          '''
          Used to list sessions.
      
          :param consul_url: The Consul server URL.
      Severity: Minor
      Found in salt/modules/consul.py - 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

      Function agent_check_fail has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def agent_check_fail(consul_url=None, token=None, checkid=None, **kwargs):
          '''
          This endpoint is used with a check that is of the TTL type. When this
          is called, the status of the check is set to critical and the
          TTL clock is reset.
      Severity: Minor
      Found in salt/modules/consul.py - 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

      Function health_service has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def health_service(consul_url=None, token=None, service=None, **kwargs):
          '''
          Health information about the registered service.
      
          :param consul_url: The Consul server URL.
      Severity: Minor
      Found in salt/modules/consul.py - 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

      Function agent_check_pass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def agent_check_pass(consul_url=None, token=None, checkid=None, **kwargs):
          '''
          This endpoint is used with a check that is of the TTL type. When this
          is called, the status of the check is set to passing and the TTL
          clock is reset.
      Severity: Minor
      Found in salt/modules/consul.py - 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

      Avoid too many return statements within this function.
      Open

                          return ret
      Severity: Major
      Found in salt/modules/consul.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return ret
        Severity: Major
        Found in salt/modules/consul.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return ret
          Severity: Major
          Found in salt/modules/consul.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return ret
            Severity: Major
            Found in salt/modules/consul.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return ret
              Severity: Major
              Found in salt/modules/consul.py - About 30 mins to fix

                Function agent_leave has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def agent_leave(consul_url=None, token=None, node=None):
                    '''
                    Used to instruct the agent to force a node into the left state.
                
                    :param consul_url: The Consul server URL.
                Severity: Minor
                Found in salt/modules/consul.py - About 25 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

                Function health_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def health_state(consul_url=None, token=None, state=None, **kwargs):
                    '''
                    Returns the checks in the state provided on the path.
                
                    :param consul_url: The Consul server URL.
                Severity: Minor
                Found in salt/modules/consul.py - About 25 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

                Function agent_service_deregister has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def agent_service_deregister(consul_url=None, token=None, serviceid=None):
                    '''
                    Used to remove a service.
                
                    :param consul_url: The Consul server URL.
                Severity: Minor
                Found in salt/modules/consul.py - About 25 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

                Function agent_check_deregister has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def agent_check_deregister(consul_url=None, token=None, checkid=None):
                    '''
                    The agent will take care of deregistering the check from the Catalog.
                
                    :param consul_url: The Consul server URL.
                Severity: Minor
                Found in salt/modules/consul.py - About 25 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

                Function list_ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def list_(consul_url=None, token=None, key=None, **kwargs):
                    '''
                    List keys in Consul
                
                    :param consul_url: The Consul server URL.
                Severity: Minor
                Found in salt/modules/consul.py - About 25 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

                Function catalog_service has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def catalog_service(consul_url=None, token=None, service=None, **kwargs):
                    '''
                    Information about the registered service.
                
                    :param consul_url: The Consul server URL.
                Severity: Minor
                Found in salt/modules/consul.py - About 25 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

                Function acl_delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def acl_delete(consul_url=None, token=None, **kwargs):
                    '''
                    Delete an ACL token.
                
                    :param consul_url: The Consul server URL.
                Severity: Minor
                Found in salt/modules/consul.py - About 25 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

                Function acl_clone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def acl_clone(consul_url=None, token=None, **kwargs):
                    '''
                    Information about an ACL token.
                
                    :param consul_url: The Consul server URL.
                Severity: Minor
                Found in salt/modules/consul.py - About 25 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

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

                def agent_check_fail(consul_url=None, token=None, checkid=None, **kwargs):
                    '''
                    This endpoint is used with a check that is of the TTL type. When this
                    is called, the status of the check is set to critical and the
                    TTL clock is reset.
                Severity: Major
                Found in salt/modules/consul.py and 2 other locations - About 2 days to fix
                salt/modules/consul.py on lines 816..862
                salt/modules/consul.py on lines 865..911

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

                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 3 locations. Consider refactoring.
                Open

                def agent_check_pass(consul_url=None, token=None, checkid=None, **kwargs):
                    '''
                    This endpoint is used with a check that is of the TTL type. When this
                    is called, the status of the check is set to passing and the TTL
                    clock is reset.
                Severity: Major
                Found in salt/modules/consul.py and 2 other locations - About 2 days to fix
                salt/modules/consul.py on lines 865..911
                salt/modules/consul.py on lines 914..960

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

                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 3 locations. Consider refactoring.
                Open

                def agent_check_warn(consul_url=None, token=None, checkid=None, **kwargs):
                    '''
                    This endpoint is used with a check that is of the TTL type. When this
                    is called, the status of the check is set to warning and the TTL
                    clock is reset.
                Severity: Major
                Found in salt/modules/consul.py and 2 other locations - About 2 days to fix
                salt/modules/consul.py on lines 816..862
                salt/modules/consul.py on lines 914..960

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

                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

                def agent_service_deregister(consul_url=None, token=None, serviceid=None):
                    '''
                    Used to remove a service.
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 1 day to fix
                salt/modules/consul.py on lines 644..684

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

                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

                def agent_leave(consul_url=None, token=None, node=None):
                    '''
                    Used to instruct the agent to force a node into the left state.
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 1 day to fix
                salt/modules/consul.py on lines 1077..1117

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

                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 3 locations. Consider refactoring.
                Open

                def catalog_node(consul_url=None, token=None, node=None, **kwargs):
                    '''
                    Information about the registered node.
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 2 other locations - About 1 day to fix
                salt/modules/consul.py on lines 1818..1856
                salt/modules/consul.py on lines 1859..1897

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

                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 3 locations. Consider refactoring.
                Open

                def health_node(consul_url=None, token=None, node=None, **kwargs):
                    '''
                    Health information about the registered node.
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 2 other locations - About 1 day to fix
                salt/modules/consul.py on lines 1777..1815
                salt/modules/consul.py on lines 1859..1897

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

                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 3 locations. Consider refactoring.
                Open

                def health_checks(consul_url=None, token=None, service=None, **kwargs):
                    '''
                    Health information about the registered service.
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 2 other locations - About 1 day to fix
                salt/modules/consul.py on lines 1777..1815
                salt/modules/consul.py on lines 1818..1856

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

                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

                def catalog_services(consul_url=None, token=None, **kwargs):
                    '''
                    Return list of available services rom catalog.
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 1 day to fix
                salt/modules/consul.py on lines 1659..1693

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

                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

                def catalog_nodes(consul_url=None, token=None, **kwargs):
                    '''
                    Return list of available nodes from catalog.
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 1 day to fix
                salt/modules/consul.py on lines 1696..1730

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

                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

                def agent_services(consul_url=None, token=None):
                    '''
                    Returns the services the local agent is managing
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 5 hrs to fix
                salt/modules/consul.py on lines 409..437

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

                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

                def agent_checks(consul_url=None, token=None):
                    '''
                    Returns the checks the local agent is managing
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 5 hrs to fix
                salt/modules/consul.py on lines 440..468

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

                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

                def status_leader(consul_url=None, token=None):
                    '''
                    Returns the current Raft leader
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 5 hrs to fix
                salt/modules/consul.py on lines 1629..1656

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

                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

                def catalog_datacenters(consul_url=None, token=None):
                    '''
                    Return list of available datacenters from catalog.
                
                    :param consul_url: The Consul server URL.
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 5 hrs to fix
                salt/modules/consul.py on lines 2003..2030

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

                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 8 locations. Consider refactoring.
                Open

                    if res['res']:
                        ret['res'] = True
                        ret['message'] = 'Catalog item {0} removed.'.format(kwargs['node'])
                    else:
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 7 other locations - About 3 hrs to fix
                salt/modules/consul.py on lines 1068..1073
                salt/modules/consul.py on lines 1260..1265
                salt/modules/consul.py on lines 1355..1360
                salt/modules/consul.py on lines 1555..1562
                salt/modules/consul.py on lines 2112..2118
                salt/modules/consul.py on lines 2178..2184
                salt/modules/consul.py on lines 2226..2232

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

                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 8 locations. Consider refactoring.
                Open

                    if res['res']:
                        ret['res'] = True
                        ret['message'] = 'Service {0} registered on agent.'.format(kwargs['name'])
                    else:
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 7 other locations - About 3 hrs to fix
                salt/modules/consul.py on lines 1260..1265
                salt/modules/consul.py on lines 1355..1360
                salt/modules/consul.py on lines 1555..1562
                salt/modules/consul.py on lines 1619..1625
                salt/modules/consul.py on lines 2112..2118
                salt/modules/consul.py on lines 2178..2184
                salt/modules/consul.py on lines 2226..2232

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

                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 8 locations. Consider refactoring.
                Open

                    if res['res']:
                        ret['res'] = True
                        ret['message'] = 'ACL {0} deleted.'.format(kwargs['id'])
                    else:
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 7 other locations - About 3 hrs to fix
                salt/modules/consul.py on lines 1068..1073
                salt/modules/consul.py on lines 1260..1265
                salt/modules/consul.py on lines 1355..1360
                salt/modules/consul.py on lines 1555..1562
                salt/modules/consul.py on lines 1619..1625
                salt/modules/consul.py on lines 2112..2118
                salt/modules/consul.py on lines 2178..2184

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

                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 8 locations. Consider refactoring.
                Open

                    if res['res']:
                        ret['res'] = True
                        ret['message'] = 'ACL {0} created.'.format(kwargs['name'])
                    else:
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 7 other locations - About 3 hrs to fix
                salt/modules/consul.py on lines 1068..1073
                salt/modules/consul.py on lines 1260..1265
                salt/modules/consul.py on lines 1355..1360
                salt/modules/consul.py on lines 1555..1562
                salt/modules/consul.py on lines 1619..1625
                salt/modules/consul.py on lines 2112..2118
                salt/modules/consul.py on lines 2226..2232

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

                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 8 locations. Consider refactoring.
                Open

                    if res['res']:
                        ret['res'] = True
                        ret['message'] = 'Created session {0}.'.format(kwargs['name'])
                    else:
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 7 other locations - About 3 hrs to fix
                salt/modules/consul.py on lines 1068..1073
                salt/modules/consul.py on lines 1355..1360
                salt/modules/consul.py on lines 1555..1562
                salt/modules/consul.py on lines 1619..1625
                salt/modules/consul.py on lines 2112..2118
                salt/modules/consul.py on lines 2178..2184
                salt/modules/consul.py on lines 2226..2232

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

                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 8 locations. Consider refactoring.
                Open

                    if res['res']:
                        ret['res'] = True
                        ret['message'] = ('Catalog registration '
                                          'for {0} successful.'.format(kwargs['node']))
                    else:
                Severity: Major
                Found in salt/modules/consul.py and 7 other locations - About 3 hrs to fix
                salt/modules/consul.py on lines 1068..1073
                salt/modules/consul.py on lines 1260..1265
                salt/modules/consul.py on lines 1355..1360
                salt/modules/consul.py on lines 1619..1625
                salt/modules/consul.py on lines 2112..2118
                salt/modules/consul.py on lines 2178..2184
                salt/modules/consul.py on lines 2226..2232

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

                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 8 locations. Consider refactoring.
                Open

                    if res['res']:
                        ret['res'] = True
                        ret['message'] = 'ACL {0} created.'.format(kwargs['name'])
                    else:
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 7 other locations - About 3 hrs to fix
                salt/modules/consul.py on lines 1068..1073
                salt/modules/consul.py on lines 1260..1265
                salt/modules/consul.py on lines 1355..1360
                salt/modules/consul.py on lines 1555..1562
                salt/modules/consul.py on lines 1619..1625
                salt/modules/consul.py on lines 2178..2184
                salt/modules/consul.py on lines 2226..2232

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

                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 8 locations. Consider refactoring.
                Open

                    if res['res']:
                        ret['res'] = True
                        ret['message'] = 'Created Service {0}.'.format(kwargs['name'])
                    else:
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 7 other locations - About 3 hrs to fix
                salt/modules/consul.py on lines 1068..1073
                salt/modules/consul.py on lines 1260..1265
                salt/modules/consul.py on lines 1555..1562
                salt/modules/consul.py on lines 1619..1625
                salt/modules/consul.py on lines 2112..2118
                salt/modules/consul.py on lines 2178..2184
                salt/modules/consul.py on lines 2226..2232

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

                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

                    if 'script' in kwargs:
                        if 'interval' not in kwargs:
                            ret['message'] = 'Required parameter "interval" is missing.'
                            ret['res'] = False
                            return ret
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 3 hrs to fix
                salt/modules/consul.py on lines 748..754

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

                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

                    if 'http' in kwargs:
                        if 'interval' not in kwargs:
                            ret['message'] = 'Required parameter "interval" is missing.'
                            ret['res'] = False
                            return ret
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 3 hrs to fix
                salt/modules/consul.py on lines 740..746

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

                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

                    if res['res']:
                        ret['res'] = True
                        ret['message'] = ('Check {0} added to agent.'.format(kwargs['name']))
                    else:
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 2 hrs to fix
                salt/modules/consul.py on lines 587..593

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

                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

                    if res['res']:
                        ret['res'] = True
                        ret['message'] = ('Agent maintenance mode '
                                          '{0}ed.'.format(kwargs['enable']))
                    else:
                Severity: Major
                Found in salt/modules/consul.py and 1 other location - About 2 hrs to fix
                salt/modules/consul.py on lines 766..771

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

                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 5 locations. Consider refactoring.
                Open

                    if 'id' in kwargs:
                        data['ID'] = kwargs['id']
                    else:
                        ret['message'] = 'Required parameter "id" is missing.'
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 4 other locations - About 1 hr to fix
                salt/modules/consul.py on lines 571..576
                salt/modules/consul.py on lines 1151..1156
                salt/modules/consul.py on lines 1450..1455
                salt/modules/consul.py on lines 1599..1604

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

                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 5 locations. Consider refactoring.
                Open

                    if 'node' in kwargs:
                        data['Node'] = kwargs['node']
                    else:
                        ret['message'] = 'Required argument node argument is missing.'
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 4 other locations - About 1 hr to fix
                salt/modules/consul.py on lines 571..576
                salt/modules/consul.py on lines 1151..1156
                salt/modules/consul.py on lines 1599..1604
                salt/modules/consul.py on lines 2153..2158

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

                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 5 locations. Consider refactoring.
                Open

                    if 'enable' in kwargs:
                        query_params['enable'] = kwargs['enable']
                    else:
                        ret['message'] = 'Required parameter "enable" is missing.'
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 4 other locations - About 1 hr to fix
                salt/modules/consul.py on lines 571..576
                salt/modules/consul.py on lines 1450..1455
                salt/modules/consul.py on lines 1599..1604
                salt/modules/consul.py on lines 2153..2158

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

                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 5 locations. Consider refactoring.
                Open

                    if 'enable' in kwargs:
                        query_params['enable'] = kwargs['enable']
                    else:
                        ret['message'] = 'Required parameter "enable" is missing.'
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 4 other locations - About 1 hr to fix
                salt/modules/consul.py on lines 1151..1156
                salt/modules/consul.py on lines 1450..1455
                salt/modules/consul.py on lines 1599..1604
                salt/modules/consul.py on lines 2153..2158

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

                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 5 locations. Consider refactoring.
                Open

                    if 'node' in kwargs:
                        data['Node'] = kwargs['node']
                    else:
                        ret['message'] = 'Node argument required.'
                        ret['res'] = False
                Severity: Major
                Found in salt/modules/consul.py and 4 other locations - About 1 hr to fix
                salt/modules/consul.py on lines 571..576
                salt/modules/consul.py on lines 1151..1156
                salt/modules/consul.py on lines 1450..1455
                salt/modules/consul.py on lines 2153..2158

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

                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