saltstack/salt

View on GitHub
salt/state.py

Summary

Maintainability
F
3 mos
Test Coverage

Function requisite_in has a Cognitive Complexity of 534 (exceeds 5 allowed). Consider refactoring.
Open

    def requisite_in(self, high):
        '''
        Extend the data reference with requisite_in arguments
        '''
        req_in = {'require_in', 'watch_in', 'onfail_in', 'onchanges_in', 'use', 'use_in', 'prereq', 'prereq_in'}
Severity: Minor
Found in salt/state.py - About 1 wk to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File state.py has 3807 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
The State Compiler is used to execute states in Salt. A state is unlike
an execution module in that instead of just executing a command, it
ensures that a certain state is present on the system.
Severity: Major
Found in salt/state.py - About 1 wk to fix

    Function check_requisite has a Cognitive Complexity of 200 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_requisite(self, low, running, chunks, pre=False):
            '''
            Look into the running data to check the status of all requisite
            states
            '''
    Severity: Minor
    Found in salt/state.py - About 4 days 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 verify_high has a Cognitive Complexity of 173 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify_high(self, high):
            '''
            Verify that the high data is viable and follows the data structure
            '''
            errors = []
    Severity: Minor
    Found in salt/state.py - About 3 days 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 verify_high has a Cognitive Complexity of 155 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify_high(self, high):
            '''
            Verify that the high data is viable and follows the data structure
            '''
            errors = []
    Severity: Minor
    Found in salt/state.py - About 3 days 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 call_chunk has a Cognitive Complexity of 155 (exceeds 5 allowed). Consider refactoring.
    Open

        def call_chunk(self, low, running, chunks):
            '''
            Check if a chunk has any requires, execute the requires and then
            the chunk
            '''
    Severity: Minor
    Found in salt/state.py - About 3 days 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 render_state has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring.
    Open

        def render_state(self, sls, saltenv, mods, matches, local=False):
            '''
            Render a state file and retrieve all of the include states
            '''
            errors = []
    Severity: Minor
    Found in salt/state.py - About 2 days 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 call_listen has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring.
    Open

        def call_listen(self, chunks, running):
            '''
            Find all of the listen routines and call the associated mod_watch runs
            '''
            listeners = []
    Severity: Minor
    Found in salt/state.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 call has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
    Open

        def call(self, low, chunks=None, running=None, retries=1):
            '''
            Call a state directly with the low data structure, verify data
            before processing.
            '''
    Severity: Minor
    Found in salt/state.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 compile_high_data has a Cognitive Complexity of 81 (exceeds 5 allowed). Consider refactoring.
    Open

        def compile_high_data(self, high, orchestration_jid=None):
            '''
            "Compile" the high data as it is retrieved from the CLI or YAML into
            the individual state executor structures
            '''
    Severity: Minor
    Found in salt/state.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 compile_high_data has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
    Open

        def compile_high_data(self, high):
            '''
            "Compile" the high data as it is retrieved from the CLI or YAML into
            the individual state executor structures
            '''
    Severity: Minor
    Found in salt/state.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

    Cyclomatic complexity is too high in method check_requisite. (80)
    Open

        def check_requisite(self, low, running, chunks, pre=False):
            '''
            Look into the running data to check the status of all requisite
            states
            '''
    Severity: Minor
    Found in salt/state.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 reconcile_extend has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
    Open

        def reconcile_extend(self, high):
            '''
            Pull the extend data and add it to the respective high data
            '''
            errors = []
    Severity: Minor
    Found in salt/state.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

    Cyclomatic complexity is too high in method requisite_in. (73)
    Open

        def requisite_in(self, high):
            '''
            Extend the data reference with requisite_in arguments
            '''
            req_in = {'require_in', 'watch_in', 'onfail_in', 'onchanges_in', 'use', 'use_in', 'prereq', 'prereq_in'}
    Severity: Minor
    Found in salt/state.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 format_slots has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

        def format_slots(self, cdata):
            '''
            Read in the arguments from the low level slot syntax to make a last
            minute runtime call to gather relevant data for the specific routine
    
    
    Severity: Minor
    Found in salt/state.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 top_matches has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

        def top_matches(self, top):
            '''
            Search through the top high data for matches and return the states
            that this minion needs to execute.
    
    
    Severity: Minor
    Found in salt/state.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 format_log has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
    Open

    def format_log(ret):
        '''
        Format the state into a log message
        '''
        msg = ''
    Severity: Minor
    Found in salt/state.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 get_tops has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_tops(self):
            '''
            Gather the top files
            '''
            tops = DefaultOrderedDict(list)
    Severity: Minor
    Found in salt/state.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 _handle_iorder has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
    Open

        def _handle_iorder(self, state):
            '''
            Take a state and apply the iorder system
            '''
            if self.opts['state_auto_order']:
    Severity: Minor
    Found in salt/state.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

    Cyclomatic complexity is too high in method call_chunk. (59)
    Open

        def call_chunk(self, low, running, chunks):
            '''
            Check if a chunk has any requires, execute the requires and then
            the chunk
            '''
    Severity: Minor
    Found in salt/state.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 _merge_tops_same has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

        def _merge_tops_same(self, tops):
            '''
            For each saltenv, only consider the top file from that saltenv. All
            sections matching a given saltenv, which appear in a different
            saltenv's top file, will be ignored.
    Severity: Minor
    Found in salt/state.py - About 7 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 method call. (54)
    Open

        @salt.utils.decorators.state.OutputUnifier('content_check', 'unify')
        def call(self, low, chunks=None, running=None, retries=1):
            '''
            Call a state directly with the low data structure, verify data
            before processing.
    Severity: Minor
    Found in salt/state.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 verify_data has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify_data(self, data):
            '''
            Verify the data, return an error statement if something is wrong
            '''
            errors = []
    Severity: Minor
    Found in salt/state.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 find_name has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    def find_name(name, state, high):
        '''
        Scan high data for the id referencing the given name and return a list of (IDs, state) tuples that match
    
        Note: if `state` is sls, then we are looking for all IDs that match the given SLS
    Severity: Minor
    Found in salt/state.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 verify_tops has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def verify_tops(self, tops):
            '''
            Verify the contents of the top file data
            '''
            errors = []
    Severity: Minor
    Found in salt/state.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

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

        def render_highstate(self, matches):
            '''
            Gather the state files and render them into a single unified salt
            high data structure.
            '''
    Severity: Minor
    Found in salt/state.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

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

        def _merge_tops_merge_all(self, tops):
            '''
            Merge the top files into a single dictionary
            '''
            def _read_tgt(tgt):
    Severity: Minor
    Found in salt/state.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

    State has 40 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class State(object):
        '''
        Class used to execute salt states
        '''
        def __init__(
    Severity: Minor
    Found in salt/state.py - About 5 hrs to fix

      Function _handle_state_decls has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def _handle_state_decls(self, state, sls, saltenv, errors):
              '''
              Add sls and saltenv components to the state
              '''
              for name in state:
      Severity: Minor
      Found in salt/state.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

      Function pad_funcs has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          def pad_funcs(self, high):
              '''
              Turns dot delimited function refs into function strings
              '''
              for name in high:
      Severity: Minor
      Found in salt/state.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

      Function check_pause has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_pause(self, low):
              '''
              Check to see if this low chunk has been paused
              '''
              if not self.jid:
      Severity: Minor
      Found in salt/state.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

      Function render_template has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          def render_template(self, high, template):
              errors = []
              if not high:
                  return high, errors
      
      
      Severity: Minor
      Found in salt/state.py - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function _merge_tops_merge has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          def _merge_tops_merge(self, tops):
              '''
              The default merging strategy. The base env is authoritative, so it is
              checked first, followed by the remaining environments. In top files
              from environments other than "base", only the section matching the
      Severity: Minor
      Found in salt/state.py - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function apply_exclude has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          def apply_exclude(self, high):
              '''
              Read in the __exclude__ list and remove all excluded objects from the
              high data
              '''
      Severity: Minor
      Found in salt/state.py - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Cyclomatic complexity is too high in method render_state. (36)
      Open

          def render_state(self, sls, saltenv, mods, matches, local=False):
              '''
              Render a state file and retrieve all of the include states
              '''
              errors = []
      Severity: Minor
      Found in salt/state.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 _handle_extend has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          def _handle_extend(self, state, sls, saltenv, errors):
              '''
              Take the extend dec out of state and apply to the highstate global
              dec
              '''
      Severity: Minor
      Found in salt/state.py - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Cyclomatic complexity is too high in method call_listen. (34)
      Open

          def call_listen(self, chunks, running):
              '''
              Find all of the listen routines and call the associated mod_watch runs
              '''
              listeners = []
      Severity: Minor
      Found in salt/state.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 method verify_high. (34)
      Open

          def verify_high(self, high):
              '''
              Verify that the high data is viable and follows the data structure
              '''
              errors = []
      Severity: Minor
      Found in salt/state.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 load_modules has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def load_modules(self, data=None, proxy=None):
              '''
              Load the modules into the state
              '''
              log.info('Loading fresh modules for state activity')
      Severity: Minor
      Found in salt/state.py - About 3 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 apply_exclude has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def apply_exclude(self, high):
              '''
              Read in the __exclude__ list and remove all excluded objects from the
              high data
              '''
      Severity: Minor
      Found in salt/state.py - About 3 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 order_chunks has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def order_chunks(self, chunks):
              '''
              Sort the chunk list verifying that the chunks follow the order
              specified in the order options.
              '''
      Severity: Minor
      Found in salt/state.py - About 3 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 order_chunks has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def order_chunks(self, chunks):
              '''
              Sort the chunk list verifying that the chunks follow the order
              specified in the order options.
              '''
      Severity: Minor
      Found in salt/state.py - About 3 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 call_chunks has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def call_chunks(self, chunks):
              '''
              Iterate over a list of chunks and call them, checking for requires.
              '''
              # Check for any disabled states
      Severity: Minor
      Found in salt/state.py - About 3 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

      BaseHighState has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class BaseHighState(object):
          '''
          The BaseHighState is an abstract base class that is the foundation of
          running a highstate, extend it and add a self.state object of type State.
      
      
      Severity: Minor
      Found in salt/state.py - About 3 hrs to fix

        Cyclomatic complexity is too high in method verify_high. (30)
        Open

            def verify_high(self, high):
                '''
                Verify that the high data is viable and follows the data structure
                '''
                errors = []
        Severity: Minor
        Found in salt/state.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 _run_check_onlyif has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def _run_check_onlyif(self, low_data, cmd_opts):
                '''
                Check that unless doesn't return 0, and that onlyif returns a 0.
                '''
                ret = {'result': False}
        Severity: Minor
        Found in salt/state.py - About 3 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 call_highstate has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def call_highstate(self, exclude=None, cache=None, cache_name='highstate',
                               force=False, whitelist=None, orchestration_jid=None):
                '''
                Run the sequence to execute the salt highstate for this minion
                '''
        Severity: Minor
        Found in salt/state.py - About 3 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 _run_check_unless has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            def _run_check_unless(self, low_data, cmd_opts):
                '''
                Check that unless doesn't return 0, and that onlyif returns a 0.
                '''
                ret = {'result': False}
        Severity: Minor
        Found in salt/state.py - About 3 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 method get_tops. (27)
        Open

            def get_tops(self):
                '''
                Gather the top files
                '''
                tops = DefaultOrderedDict(list)
        Severity: Minor
        Found in salt/state.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 check_refresh has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def check_refresh(self, data, ret):
                '''
                Check to see if the modules for this state instance need to be updated,
                only update if the state is a file or a package and if it changed
                something. If the file function is managed check to see if the file is a
        Severity: Minor
        Found in salt/state.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 inject_default_call has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def inject_default_call(self, high):
                '''
                Sets .call function to a state, if not there.
        
                :param high:
        Severity: Minor
        Found in salt/state.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 method verify_data. (24)
        Open

            def verify_data(self, data):
                '''
                Verify the data, return an error statement if something is wrong
                '''
                errors = []
        Severity: Minor
        Found in salt/state.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 method compile_high_data. (23)
        Open

            def compile_high_data(self, high, orchestration_jid=None):
                '''
                "Compile" the high data as it is retrieved from the CLI or YAML into
                the individual state executor structures
                '''
        Severity: Minor
        Found in salt/state.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 find_sls_ids has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        def find_sls_ids(sls, high):
            '''
            Scan for all ids in the given sls and return them in a dict; {name: state}
            '''
            ret = []
        Severity: Minor
        Found in salt/state.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 method reconcile_extend. (22)
        Open

            def reconcile_extend(self, high):
                '''
                Pull the extend data and add it to the respective high data
                '''
                errors = []
        Severity: Minor
        Found in salt/state.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 reconcile_procs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def reconcile_procs(self, running):
                '''
                Check the running dict for processes and resolve them
                '''
                retset = set()
        Severity: Minor
        Found in salt/state.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

        Cyclomatic complexity is too high in function format_log. (21)
        Open

        def format_log(ret):
            '''
            Format the state into a log message
            '''
            msg = ''
        Severity: Minor
        Found in salt/state.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 _gather_pillar has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _gather_pillar(self):
                '''
                Whenever a state run starts, gather the pillar data fresh
                '''
                if self._pillar_override:
        Severity: Minor
        Found in salt/state.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 verify_retry_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def verify_retry_data(self, retry_data):
                '''
                verifies the specified retry data
                '''
                retry_defaults = {
        Severity: Minor
        Found in salt/state.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 call has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def call(self, low, chunks=None, running=None, retries=1):
                '''
                Call a state directly with the low data structure, verify data
                before processing.
                '''
        Severity: Minor
        Found in salt/state.py - About 1 hr to fix

          Function matches_whitelist has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def matches_whitelist(self, matches, whitelist):
                  '''
                  Reads over the matches and returns a matches dict with just the ones
                  that are in the whitelist
                  '''
          Severity: Minor
          Found in salt/state.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 call_high has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def call_high(self, high, orchestration_jid=None):
                  '''
                  Process a high data call and ensure the defined states.
                  '''
                  self.inject_default_call(high)
          Severity: Minor
          Found in salt/state.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 _mod_aggregate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def _mod_aggregate(self, low, running, chunks):
                  '''
                  Execute the aggregation systems to runtime modify the low chunk
                  '''
                  agg_opt = self.functions['config.option']('state_aggregate')
          Severity: Minor
          Found in salt/state.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 __eval_slot has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def __eval_slot(self, slot):
                  log.debug('Evaluating slot: %s', slot)
                  fmt = slot.split(':', 2)
                  if len(fmt) != 3:
                      log.warning('Malformed slot: %s', slot)
          Severity: Minor
          Found in salt/state.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 clean_duplicate_extends has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def clean_duplicate_extends(self, highstate):
                  if '__extend__' in highstate:
                      highext = []
                      for items in (six.iteritems(ext) for ext in highstate['__extend__']):
                          for item in items:
          Severity: Minor
          Found in salt/state.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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(
                      self,
                      opts,
                      pillar_override=None,
                      jid=None,
          Severity: Minor
          Found in salt/state.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 event has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def event(self, chunk_ret, length, fire_event=False):
                  '''
                  Fire an event on the master bus
          
                  If `fire_event` is set to True an event will be sent with the
          Severity: Minor
          Found in salt/state.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 merge_included_states has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def merge_included_states(self, highstate, state, errors):
                  # The extend members can not be treated as globally unique:
                  if '__extend__' in state:
                      highstate.setdefault('__extend__',
                                           []).extend(state.pop('__extend__'))
          Severity: Minor
          Found in salt/state.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 __gen_opts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def __gen_opts(self, opts):
                  '''
                  The options used by the High State object are derived from options
                  on the minion and the master, or just the minion if the high state
                  call is entirely local.
          Severity: Minor
          Found in salt/state.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

          Avoid deeply nested control flow statements.
          Open

                                  for fun in funcs:
                                      live['fun'] = fun
                                      chunks.append(live)
                          else:
          Severity: Major
          Found in salt/state.py - About 45 mins to fix

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

                def compile_state_usage(self):
                    '''
                    Return all used and unused states for the minion based on the top match data
                    '''
                    err = []
            Severity: Minor
            Found in salt/state.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

            Avoid deeply nested control flow statements.
            Open

                                    for key, val in six.iteritems(arg):
                                        if key == 'names':
                                            for _name in val:
                                                if _name not in names:
                                                    names.append(_name)
            Severity: Major
            Found in salt/state.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  for arg in high[nid][state]:
                                      if not isinstance(arg, dict):
                                          continue
                                      if len(arg) != 1:
                                          continue
              Severity: Major
              Found in salt/state.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if state == 'require' or state == 'watch':
                                            continue
                                        errors.append(('No function declared in state \'{0}\' in'
                Severity: Major
                Found in salt/state.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if isinstance(entry, dict):
                                              low_name = next(six.iterkeys(entry))
                                              live['name'] = low_name
                                              list(map(live.update, entry[low_name]))
                                          else:
                  Severity: Major
                  Found in salt/state.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if len(comps) >= 2:
                                                # Merge the comps
                                                comps[1] = '.'.join(comps[1:len(comps)])
                                            high[name] = {
                    Severity: Major
                    Found in salt/state.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if isinstance(arg, six.string_types):
                                                  fun += 1
                                                  if ' ' in arg.strip():
                                                      errors.append(('The function "{0}" in state '
                                                      '"{1}" in SLS "{2}" has '
                      Severity: Major
                      Found in salt/state.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if isinstance(chg['diff'], six.string_types):
                                                msg = 'File changed:\n{0}'.format(chg['diff'])
                                        if all([isinstance(x, dict) for x in six.itervalues(chg)]):
                        Severity: Major
                        Found in salt/state.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if funcs:
                                                      for func in funcs:
                                                          f_key = '{0}{1}'.format(
                                                                  mod,
                                                                  func[func.rindex('.'):]
                          Severity: Major
                          Found in salt/state.py - About 45 mins to fix

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

                                def _run_check(self, low_data):
                                    '''
                                    Check that unless doesn't return 0, and that onlyif returns a 0.
                                    '''
                                    ret = {'result': False, 'comment': []}
                            Severity: Minor
                            Found in salt/state.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

                            Avoid deeply nested control flow statements.
                            Open

                                                if all([('old' in x and 'new' in x)
                                                        for x in six.itervalues(chg)]):
                                                    msg = 'Made the following changes:\n'
                                                    for pkg in chg:
                                                        old = chg[pkg]['old']
                            Severity: Major
                            Found in salt/state.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if key in disabled_reqs:
                                                          log.warning('The %s requisite has been disabled, Ignoring.', key)
                                                          continue
                                                      rkey = key.split('_')[0]
                              Severity: Major
                              Found in salt/state.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if retries == 1:
                                                            ret['start_time'] = orig_ret['start_time']
                                            else:
                                Severity: Major
                                Found in salt/state.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if match:
                                                              levels, include = match.groups()
                                                          else:
                                                              msg = ('Badly formatted include {0} found in include '
                                                                      'in SLS \'{2}:{3}\''
                                  Severity: Major
                                  Found in salt/state.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            for sls_target in sls_targets:
                                                                r_env = resolved_envs[0] if len(resolved_envs) == 1 else saltenv
                                                                mod_tgt = '{0}:{1}'.format(r_env, sls_target)
                                                                if mod_tgt not in mods:
                                                                    nstate, err = self.render_state(
                                    Severity: Major
                                    Found in salt/state.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if not update:
                                                                  high[name][state].append(arg)
                                              return high, errors
                                      Severity: Major
                                      Found in salt/state.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                if req_val is None:
                                                                    continue
                                                                if req_key == 'sls':
                                        Severity: Major
                                        Found in salt/state.py - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                                  if not slsmod:
                                                                      errors.append(
                                                                          'Environment {0} contains an empty sls '
                                                                          'index'.format(saltenv)
                                                                      )
                                          Severity: Major
                                          Found in salt/state.py - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                    if not resolved_envs:
                                                                        msg = ('Unknown include: Specified SLS {0}: {1} is not available on the salt '
                                                                               'master in saltenv(s): {2} '
                                                                               ).format(env_key,
                                                                                        inc_sls,
                                            Severity: Major
                                            Found in salt/state.py - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                      for key, val in six.iteritems(arg):
                                                                          if key == 'names':
                                                                              for _name in val:
                                                                                  if _name not in names:
                                                                                      names.append(_name)
                                              Severity: Major
                                              Found in salt/state.py - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                        if req_key == 'sls':
                                                                            # Allow requisite tracking of entire sls files
                                                                            if fnmatch.fnmatch(chunk['__sls__'], req_val):
                                                                                found = True
                                                                                reqs[r_state].append(chunk)
                                                Severity: Major
                                                Found in salt/state.py - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                          if isinstance(arg, dict):
                                                                              if arg:
                                                                                  if next(six.iterkeys(arg)) == 'order':
                                                                                      found = True
                                                                      if not found:
                                                  Severity: Major
                                                  Found in salt/state.py - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                            if isinstance(entry, dict):
                                                                                low_name = next(six.iterkeys(entry))
                                                                                live['name'] = low_name
                                                                                list(map(live.update, entry[low_name]))
                                                                            else:
                                                    Severity: Major
                                                    Found in salt/state.py - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                              for hind in range(len(high[name][state])):
                                                                                  if isinstance(arg, six.string_types) and isinstance(high[name][state][hind], six.string_types):
                                                                                      # replacing the function, replace the index
                                                                                      high[name][state].pop(hind)
                                                                                      high[name][state].insert(hind, arg)
                                                      Severity: Major
                                                      Found in salt/state.py - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                                if isinstance(listvalue, dict):
                                                                                    # Search dict values in list for __slot__:
                                                                                    for key, value in listvalue.items():
                                                                                        try:
                                                                                            if value.startswith(SLOT_TEXT):
                                                        Severity: Major
                                                        Found in salt/state.py - About 45 mins to fix

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                                  if state_data.get('source', '').endswith('/init.sls'):
                                                                                      p_comps.append('init')
                                                                                  if level_count > len(p_comps):
                                                          Severity: Major
                                                          Found in salt/state.py - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                                    if not isinstance(state[name][s_dec], list):
                                                                                        # quite certainly a syntax error, managed elsewhere
                                                                                        continue
                                                                                    state[name][s_dec].append(
                                                            Severity: Major
                                                            Found in salt/state.py - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                                      if 'is not available' in error:
                                                                                          # match SLS foobar in environment
                                                                                          this_sls = 'SLS {0} in saltenv'.format(
                                                                                              sls_match)
                                                                                          if this_sls in error:
                                                              Severity: Major
                                                              Found in salt/state.py - About 45 mins to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

                                                                                        if isinstance(listvalue, six.text_type):
                                                                                            # Search strings in a list for __slot__:
                                                                                            if listvalue.startswith(SLOT_TEXT):
                                                                                                log.trace("Slot processsing nested string %s", listvalue)
                                                                                                cdata[atype][ind][idx] = self.__eval_slot(listvalue)
                                                                Severity: Major
                                                                Found in salt/state.py - About 45 mins to fix

                                                                  Avoid deeply nested control flow statements.
                                                                  Open

                                                                                          if sls in done[saltenv]:
                                                                                              continue
                                                                                          tops[saltenv].append(
                                                                  Severity: Major
                                                                  Found in salt/state.py - About 45 mins to fix

                                                                    Avoid deeply nested control flow statements.
                                                                    Open

                                                                                                for tgt in targets:
                                                                                                    top[saltenv][tgt] = ctop[saltenv][tgt]
                                                                                            except TypeError:
                                                                    Severity: Major
                                                                    Found in salt/state.py - About 45 mins to fix

                                                                      Avoid deeply nested control flow statements.
                                                                      Open

                                                                                                  if isinstance(item, six.string_types):
                                                                                                      matches[saltenv].append(item)
                                                                                                  elif isinstance(item, dict):
                                                                                                      env_key, inc_sls = item.popitem()
                                                                                                      if env_key not in self.avail:
                                                                      Severity: Major
                                                                      Found in salt/state.py - About 45 mins to fix

                                                                        Avoid deeply nested control flow statements.
                                                                        Open

                                                                                                if matches is None:
                                                                                                    matches = []
                                                                                                # Resolve inc_sls in the specified environment
                                                                                                if env_key in matches or fnmatch.filter(self.avail[env_key], inc_sls):
                                                                        Severity: Major
                                                                        Found in salt/state.py - About 45 mins to fix

                                                                          Avoid deeply nested control flow statements.
                                                                          Open

                                                                                                      if value.startswith(SLOT_TEXT):
                                                                                                          log.trace("Slot processsing dict value %s", value)
                                                                                                          cdata[atype][ind][key] = self.__eval_slot(value)
                                                                                                  except AttributeError:
                                                                          Severity: Major
                                                                          Found in salt/state.py - About 45 mins to fix

                                                                            Avoid deeply nested control flow statements.
                                                                            Open

                                                                                                        if 'duration' in pdat[key]:
                                                                                                            now = time.time()
                                                                                                            if now - start > pdat[key]['duration']:
                                                                                                                return 'run'
                                                                                                        if 'kill' in pdat[key]:
                                                                            Severity: Major
                                                                            Found in salt/state.py - About 45 mins to fix

                                                                              Avoid deeply nested control flow statements.
                                                                              Open

                                                                                                      for to_tag in to_tags:
                                                                                                          if to_tag not in running:
                                                                                                              continue
                                                                                                          if running[to_tag]['changes']:
                                                                                                              if not any(key[0] == cref[0] and key[1] in cref for cref in crefs):
                                                                              Severity: Major
                                                                              Found in salt/state.py - About 45 mins to fix

                                                                                Avoid deeply nested control flow statements.
                                                                                Open

                                                                                                        for tgt in targets:
                                                                                                            top[saltenv][tgt] = ctop[saltenv][tgt]
                                                                                                        break
                                                                                Severity: Major
                                                                                Found in salt/state.py - About 45 mins to fix

                                                                                  Avoid deeply nested control flow statements.
                                                                                  Open

                                                                                                              if 'subfilter' in item:
                                                                                                                  _tmpdata = item.pop('subfilter')
                                                                                                                  for match, data in six.iteritems(_tmpdata):
                                                                                                                      _filter_matches(match, data, _opts)
                                                                                                              if isinstance(item, six.string_types):
                                                                                  Severity: Major
                                                                                  Found in salt/state.py - About 45 mins to fix

                                                                                    Avoid deeply nested control flow statements.
                                                                                    Open

                                                                                                            if env_key in matches or fnmatch.filter(self.avail[env_key], inc_sls):
                                                                                                                resolved_envs = [env_key]
                                                                                                            else:
                                                                                                                resolved_envs = []
                                                                                                        else:
                                                                                    Severity: Major
                                                                                    Found in salt/state.py - About 45 mins to fix

                                                                                      Avoid deeply nested control flow statements.
                                                                                      Open

                                                                                                              for fun in funcs:
                                                                                                                  live['fun'] = fun
                                                                                                                  chunks.append(live)
                                                                                                      else:
                                                                                      Severity: Major
                                                                                      Found in salt/state.py - About 45 mins to fix

                                                                                        Avoid deeply nested control flow statements.
                                                                                        Open

                                                                                                                    if isinstance(req_val, six.string_types):
                                                                                                                        if (fnmatch.fnmatch(chunk['name'], req_val) or
                                                                                                                            fnmatch.fnmatch(chunk['__id__'], req_val)):
                                                                                                                            if req_key == 'id' or chunk['state'] == req_key:
                                                                                                                                found = True
                                                                                        Severity: Major
                                                                                        Found in salt/state.py - About 45 mins to fix

                                                                                          Avoid deeply nested control flow statements.
                                                                                          Open

                                                                                                                  if level_count > len(p_comps):
                                                                                                                      msg = ('Attempted relative include of \'{0}\' '
                                                                                                                             'within SLS \'{1}:{2}\' '
                                                                                                                             'goes beyond top level package '
                                                                                                                             .format(inc_sls, saltenv, sls))
                                                                                          Severity: Major
                                                                                          Found in salt/state.py - About 45 mins to fix

                                                                                            Avoid deeply nested control flow statements.
                                                                                            Open

                                                                                                                    if isinstance(arg, six.string_types):
                                                                                                                        fun += 1
                                                                                                                        if ' ' in arg.strip():
                                                                                                                            errors.append(('The function "{0}" in state '
                                                                                                                            '"{1}" in SLS "{2}" has '
                                                                                            Severity: Major
                                                                                            Found in salt/state.py - About 45 mins to fix

                                                                                              Avoid deeply nested control flow statements.
                                                                                              Open

                                                                                                                          if tgt not in top[saltenv]:
                                                                                                                              top[saltenv][tgt] = ctop[saltenv][tgt]
                                                                                                                              continue
                                                                                                                          m_type1, m_states1 = _read_tgt(top[saltenv][tgt])
                                                                                              Severity: Major
                                                                                              Found in salt/state.py - About 45 mins to fix

                                                                                                Avoid deeply nested control flow statements.
                                                                                                Open

                                                                                                                        if state == 'require' or state == 'watch':
                                                                                                                            continue
                                                                                                                        errors.append(
                                                                                                Severity: Major
                                                                                                Found in salt/state.py - About 45 mins to fix

                                                                                                  Avoid deeply nested control flow statements.
                                                                                                  Open

                                                                                                                          if req_key == 'sls':
                                                                                                                              # Allow requisite tracking of entire sls files
                                                                                                                              if fnmatch.fnmatch(chunk['__sls__'], req_val):
                                                                                                                                  if requisite == 'prereq':
                                                                                                                                      chunk['__prereq__'] = True
                                                                                                  Severity: Major
                                                                                                  Found in salt/state.py - About 45 mins to fix

                                                                                                    Avoid deeply nested control flow statements.
                                                                                                    Open

                                                                                                                            if chunk.get('__prerequired__'):
                                                                                                                                # Prereq recusive, run this chunk with prereq on
                                                                                                                                if tag not in self.pre:
                                                                                                                                    low['__prereq__'] = True
                                                                                                                                    self.pre[ctag] = self.call(low, chunks, running)
                                                                                                    Severity: Major
                                                                                                    Found in salt/state.py - About 45 mins to fix

                                                                                                      Avoid deeply nested control flow statements.
                                                                                                      Open

                                                                                                                              if saltenv != cenv:
                                                                                                                                  continue
                                                                                                                              log.debug(
                                                                                                      Severity: Major
                                                                                                      Found in salt/state.py - About 45 mins to fix

                                                                                                        Avoid deeply nested control flow statements.
                                                                                                        Open

                                                                                                                                    if match_type is not None:
                                                                                                                                        merged.append(match_type)
                                                                                                                                    merged.extend(m_states1)
                                                                                                        Severity: Major
                                                                                                        Found in salt/state.py - About 45 mins to fix

                                                                                                          Avoid deeply nested control flow statements.
                                                                                                          Open

                                                                                                                                  if req_ret is None:
                                                                                                                                      continue
                                                                                                                                  # If the result was False (not None) it was a failure
                                                                                                                                  if req_ret['result'] is False:
                                                                                                          Severity: Major
                                                                                                          Found in salt/state.py - About 45 mins to fix

                                                                                                            Avoid deeply nested control flow statements.
                                                                                                            Open

                                                                                                                                    if req_ret['result'] is False:
                                                                                                                                        # use SLS.ID for the key-- so its easier to find
                                                                                                                                        key = '{sls}.{_id}'.format(sls=req_low['__sls__'],
                                                                                                                                                                    _id=req_low['__id__'])
                                                                                                                                        failed_requisites.add(key)
                                                                                                            Severity: Major
                                                                                                            Found in salt/state.py - About 45 mins to fix

                                                                                                              Avoid deeply nested control flow statements.
                                                                                                              Open

                                                                                                                                      for chunk in chunks:
                                                                                                                                          if chunk['__id__'] == listen_to or \
                                                                                                                                             chunk['name'] == listen_to:
                                                                                                                                              listen_to = {chunk['state']: chunk['__id__']}
                                                                                                                                              found = True
                                                                                                              Severity: Major
                                                                                                              Found in salt/state.py - About 45 mins to fix

                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                Open

                                                                                                                                        if not found:
                                                                                                                                            continue
                                                                                                                                    for lkey, lval in six.iteritems(listen_to):
                                                                                                                Severity: Major
                                                                                                                Found in salt/state.py - About 45 mins to fix

                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                  Open

                                                                                                                                          if not any(lkey == cref[0] and lval in cref for cref in crefs):
                                                                                                                                              rerror = {_l_tag(lkey, lval):
                                                                                                                                                        {
                                                                                                                                                            'comment': 'Referenced state {0}: {1} does not exist'.format(lkey, lval),
                                                                                                                                                            'name': 'listen_{0}:{1}'.format(lkey, lval),
                                                                                                                  Severity: Major
                                                                                                                  Found in salt/state.py - About 45 mins to fix

                                                                                                                    Avoid deeply nested control flow statements.
                                                                                                                    Open

                                                                                                                                            if saltenv == 'include':
                                                                                                                                                continue
                                                                                                                                            elif saltenv != cenv:
                                                                                                                                                log.debug(
                                                                                                                                                    'Section for saltenv \'%s\' in the \'%s\' '
                                                                                                                    Severity: Major
                                                                                                                    Found in salt/state.py - About 45 mins to fix

                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                      Open

                                                                                                                                              if isinstance(items, dict):
                                                                                                                                                  # Formatted as a single req_in
                                                                                                                                                  for _state, name in six.iteritems(items):
                                                                                                                      
                                                                                                                                                      # Not a use requisite_in
                                                                                                                      Severity: Major
                                                                                                                      Found in salt/state.py - About 45 mins to fix

                                                                                                                        Avoid deeply nested control flow statements.
                                                                                                                        Open

                                                                                                                                                    if 'kill' in pdat[key]:
                                                                                                                                                        return 'kill'
                                                                                                                                                else:
                                                                                                                        Severity: Major
                                                                                                                        Found in salt/state.py - About 45 mins to fix

                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                          Open

                                                                                                                                                  if (fnmatch.fnmatch(chunk['name'], req_val) or
                                                                                                                                                      fnmatch.fnmatch(chunk['__id__'], req_val)):
                                                                                                                                                      if req_key == 'id' or chunk['state'] == req_key:
                                                                                                                                                          if requisite == 'prereq':
                                                                                                                                                              chunk['__prereq__'] = True
                                                                                                                          Severity: Major
                                                                                                                          Found in salt/state.py - About 45 mins to fix

                                                                                                                            Avoid deeply nested control flow statements.
                                                                                                                            Open

                                                                                                                                                    for val in six.itervalues(slsmod):
                                                                                                                                                        if not val:
                                                                                                                                                            errors.append(
                                                                                                                                                                'Improperly formatted top file matcher '
                                                                                                                                                                'in saltenv {0}: {1} file'.format(
                                                                                                                            Severity: Major
                                                                                                                            Found in salt/state.py - About 45 mins to fix

                                                                                                                              Avoid deeply nested control flow statements.
                                                                                                                              Open

                                                                                                                                                      if key not in req_in:
                                                                                                                                                          continue
                                                                                                                                                      if key in disabled_reqs:
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/state.py - About 45 mins to fix

                                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                                Open

                                                                                                                                                        if low['retry']['splay'] != 0:
                                                                                                                                                            interval = interval + random.randint(0, low['retry']['splay'])
                                                                                                                                                        log.info(
                                                                                                                                Severity: Major
                                                                                                                                Found in salt/state.py - About 45 mins to fix

                                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                                  Open

                                                                                                                                                          if req_val is None:
                                                                                                                                                              continue
                                                                                                                                                          if req_key == 'sls':
                                                                                                                                  Severity: Major
                                                                                                                                  Found in salt/state.py - About 45 mins to fix

                                                                                                                                    Avoid deeply nested control flow statements.
                                                                                                                                    Open

                                                                                                                                                            if not arg:
                                                                                                                                                                # Empty arg dict
                                                                                                                                                                # How did we get this far?
                                                                                                                                                                continue
                                                                                                                                                            # Split out the components
                                                                                                                                    Severity: Major
                                                                                                                                    Found in salt/state.py - About 45 mins to fix

                                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                                      Open

                                                                                                                                                              if isinstance(items, list):
                                                                                                                                                                  # Formed as a list of requisite additions
                                                                                                                                                                  hinges = []
                                                                                                                                                                  for ind in items:
                                                                                                                                                                      if not isinstance(ind, dict):
                                                                                                                                      Severity: Major
                                                                                                                                      Found in salt/state.py - About 45 mins to fix

                                                                                                                                        Consider simplifying this complex logical expression.
                                                                                                                                        Open

                                                                                                                                                    if lost['require'] or lost['watch'] or lost['prereq'] \
                                                                                                                                                                or lost['onfail'] or lost['onchanges'] \
                                                                                                                                                                or lost.get('prerequired'):
                                                                                                                                                        comment = 'The following requisites were not found:\n'
                                                                                                                                                        for requisite, lreqs in six.iteritems(lost):
                                                                                                                                        Severity: Major
                                                                                                                                        Found in salt/state.py - About 40 mins to fix

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

                                                                                                                                              def _mod_init(self, low):
                                                                                                                                                  '''
                                                                                                                                                  Check the module initialization function, if this is the first run
                                                                                                                                                  of a state package that has a mod_init function, then execute the
                                                                                                                                                  mod_init function in the state module.
                                                                                                                                          Severity: Minor
                                                                                                                                          Found in salt/state.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 state_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                          Open

                                                                                                                                          def state_args(id_, state, high):
                                                                                                                                              '''
                                                                                                                                              Return a set of the arguments passed to the named state
                                                                                                                                              '''
                                                                                                                                              args = set()
                                                                                                                                          Severity: Minor
                                                                                                                                          Found in salt/state.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 err
                                                                                                                                          Severity: Major
                                                                                                                                          Found in salt/state.py - About 30 mins to fix

                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                            Open

                                                                                                                                                    return 'run'
                                                                                                                                            Severity: Major
                                                                                                                                            Found in salt/state.py - About 30 mins to fix

                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                              Open

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

                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                Open

                                                                                                                                                                return running
                                                                                                                                                Severity: Major
                                                                                                                                                Found in salt/state.py - About 30 mins to fix

                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                  Open

                                                                                                                                                          return running
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in salt/state.py - About 30 mins to fix

                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                    Open

                                                                                                                                                            return self.state.call_high(high, orchestration_jid)
                                                                                                                                                    Severity: Major
                                                                                                                                                    Found in salt/state.py - About 30 mins to fix

                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                      Open

                                                                                                                                                                              return running
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in salt/state.py - About 30 mins to fix

                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                        Open

                                                                                                                                                                                    return 'run'
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in salt/state.py - About 30 mins to fix

                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                          Open

                                                                                                                                                                          return 'run'
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in salt/state.py - About 30 mins to fix

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

                                                                                                                                                                def _get_envs(self):
                                                                                                                                                                    '''
                                                                                                                                                                    Pull the file server environments out of the master options
                                                                                                                                                                    '''
                                                                                                                                                                    envs = ['base']
                                                                                                                                                            Severity: Minor
                                                                                                                                                            Found in salt/state.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 module_refresh has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                def module_refresh(self):
                                                                                                                                                                    '''
                                                                                                                                                                    Refresh all the modules
                                                                                                                                                                    '''
                                                                                                                                                                    log.debug('Refreshing modules...')
                                                                                                                                                            Severity: Minor
                                                                                                                                                            Found in salt/state.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 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                                if key == 'use_in':
                                                                                                                                                                                                    # Add the running states args to the
                                                                                                                                                                                                    # use_in states
                                                                                                                                                                                                    ext_ids = find_name(name, _state, high)
                                                                                                                                                                                                    for ext_id, _req_state in ext_ids:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 2 days to fix
                                                                                                                                                            salt/state.py on lines 1742..1768

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

                                                                                                                                                            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 key == 'use':
                                                                                                                                                                                                    # Add the use state's args to the
                                                                                                                                                                                                    # running state
                                                                                                                                                                                                    ext_ids = find_name(name, _state, high)
                                                                                                                                                                                                    for ext_id, _req_state in ext_ids:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 2 days to fix
                                                                                                                                                            salt/state.py on lines 1715..1741

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

                                                                                                                                                            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 '.' in key:
                                                                                                                                                                                comps = key.split('.')
                                                                                                                                                                                # Salt doesn't support state files such as:
                                                                                                                                                                                #
                                                                                                                                                                                #     /etc/redis/redis.conf:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 day to fix
                                                                                                                                                            salt/state.py on lines 3049..3070

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

                                                                                                                                                            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 '.' in key:
                                                                                                                                                                                comps = key.split('.')
                                                                                                                                                                                # Salt doesn't support state files such as:
                                                                                                                                                                                #
                                                                                                                                                                                # /etc/redis/redis.conf:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 day to fix
                                                                                                                                                            salt/state.py on lines 3883..3904

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                    for exc in exclude:
                                                                                                                                                                        if isinstance(exc, six.string_types):
                                                                                                                                                                            # The exclude statement is a string, assume it is an sls
                                                                                                                                                                            ex_sls.add(exc)
                                                                                                                                                                        if isinstance(exc, dict):
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 7 hrs to fix
                                                                                                                                                            salt/state.py on lines 1540..1552

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                    for exc in exclude:
                                                                                                                                                                        if isinstance(exc, six.string_types):
                                                                                                                                                                            # The exclude statement is a string, assume it is an sls
                                                                                                                                                                            ex_sls.add(exc)
                                                                                                                                                                        if isinstance(exc, dict):
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 7 hrs to fix
                                                                                                                                                            salt/state.py on lines 687..699

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                                    if req_val in reqs:
                                                                                                                                                                                                        if name in reqs[req_val]:
                                                                                                                                                                                                            if reqs[req_val][name] == state:
                                                                                                                                                                                                                if reqs[req_val]['state'] == reqs[name][req_val]:
                                                                                                                                                                                                                    err = ('A recursive '
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 7 hrs to fix
                                                                                                                                                            salt/state.py on lines 1319..1331

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                                    if req_val in reqs:
                                                                                                                                                                                                        if name in reqs[req_val]:
                                                                                                                                                                                                            if reqs[req_val][name] == state:
                                                                                                                                                                                                                if reqs[req_val]['state'] == reqs[name][req_val]:
                                                                                                                                                                                                                    err = ('A recursive '
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 7 hrs to fix
                                                                                                                                                            salt/state.py on lines 553..565

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                                for ind in range(len(extend[name][_state])):
                                                                                                                                                                                                    if next(iter(
                                                                                                                                                                                                        extend[name][_state][ind])) == rkey:
                                                                                                                                                                                                        # Extending again
                                                                                                                                                                                                        extend[name][_state][ind][rkey].append(
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 6 hrs to fix
                                                                                                                                                            salt/state.py on lines 1630..1637

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                            for ind in range(len(extend[name][_state])):
                                                                                                                                                                                                if next(iter(
                                                                                                                                                                                                    extend[name][_state][ind])) == rkey:
                                                                                                                                                                                                    # Extending again
                                                                                                                                                                                                    extend[name][_state][ind][rkey].append(
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 6 hrs to fix
                                                                                                                                                            salt/state.py on lines 1776..1783

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

                                                                                                                                                            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 mopts['state_top'].startswith('salt://'):
                                                                                                                                                                            opts['state_top'] = mopts['state_top']
                                                                                                                                                                        elif mopts['state_top'].startswith('/'):
                                                                                                                                                                            opts['state_top'] = salt.utils.url.create(mopts['state_top'][1:])
                                                                                                                                                                        else:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 6 hrs to fix
                                                                                                                                                            salt/pillar/__init__.py on lines 489..494

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                        if not isinstance(chunk['order'], (int, float)):
                                                                                                                                                                            if chunk['order'] == 'last':
                                                                                                                                                                                chunk['order'] = cap + 1000000
                                                                                                                                                                            elif chunk['order'] == 'first':
                                                                                                                                                                                chunk['order'] = 0
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 5 hrs to fix
                                                                                                                                                            salt/state.py on lines 605..611

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                        if not isinstance(chunk['order'], (int, float)):
                                                                                                                                                                            if chunk['order'] == 'last':
                                                                                                                                                                                chunk['order'] = cap + 1000000
                                                                                                                                                                            elif chunk['order'] == 'first':
                                                                                                                                                                                chunk['order'] = 0
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 5 hrs to fix
                                                                                                                                                            salt/state.py on lines 1382..1388

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                if not fun:
                                                                                                                                                                                    if state == 'require' or state == 'watch':
                                                                                                                                                                                        continue
                                                                                                                                                                                    errors.append(('No function declared in state \'{0}\' in'
                                                                                                                                                                                        ' SLS \'{1}\'').format(state, body['__sls__']))
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 4 hrs to fix
                                                                                                                                                            salt/state.py on lines 1340..1350

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                if not fun:
                                                                                                                                                                                    if state == 'require' or state == 'watch':
                                                                                                                                                                                        continue
                                                                                                                                                                                    errors.append(
                                                                                                                                                                                        'No function declared in state \'{0}\' in SLS \'{1}\''
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 4 hrs to fix
                                                                                                                                                            salt/state.py on lines 574..582

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                    for chunk in chunks:
                                                                                                                                                                        if 'order' in chunk:
                                                                                                                                                                            if not isinstance(chunk['order'], int):
                                                                                                                                                                                continue
                                                                                                                                                            
                                                                                                                                                            
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 4 hrs to fix
                                                                                                                                                            salt/state.py on lines 592..599

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                    for chunk in chunks:
                                                                                                                                                                        if 'order' in chunk:
                                                                                                                                                                            if not isinstance(chunk['order'], int):
                                                                                                                                                                                continue
                                                                                                                                                            
                                                                                                                                                            
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 4 hrs to fix
                                                                                                                                                            salt/state.py on lines 1369..1376

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

                                                                                                                                                            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 'watch' in low:
                                                                                                                                                                        if '{0}.mod_watch'.format(low['state']) not in self.states:
                                                                                                                                                                            if 'require' in low:
                                                                                                                                                                                low['require'].extend(low.pop('watch'))
                                                                                                                                                                            else:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 4 hrs to fix
                                                                                                                                                            salt/state.py on lines 2413..2420

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

                                                                                                                                                            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 'watch_any' in low:
                                                                                                                                                                        if '{0}.mod_watch'.format(low['state']) not in self.states:
                                                                                                                                                                            if 'require_any' in low:
                                                                                                                                                                                low['require_any'].extend(low.pop('watch_any'))
                                                                                                                                                                            else:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 4 hrs to fix
                                                                                                                                                            salt/state.py on lines 2405..2412

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

                                                                                                                                                            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

                                                                                                                                                                                                    for ext_id, _req_state in ext_ids:
                                                                                                                                                                                                        if ext_id not in extend:
                                                                                                                                                                                                            extend[ext_id] = OrderedDict()
                                                                                                                                                                                                        if _req_state not in extend[ext_id]:
                                                                                                                                                                                                            extend[ext_id][_req_state] = []
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 4 hrs to fix
                                                                                                                                                            salt/state.py on lines 1694..1701

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

                                                                                                                                                            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 key == 'prereq_in':
                                                                                                                                                                                                    # Add prerequired to origin
                                                                                                                                                                                                    if id_ not in extend:
                                                                                                                                                                                                        extend[id_] = OrderedDict()
                                                                                                                                                                                                    if state not in extend[id_]:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 4 hrs to fix
                                                                                                                                                            salt/state.py on lines 1706..1712

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                    for saltenv, ctops in six.iteritems(tops):
                                                                                                                                                                        for ctop in ctops:
                                                                                                                                                                            if 'include' not in ctop:
                                                                                                                                                                                continue
                                                                                                                                                                            for sls in ctop['include']:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 3 hrs to fix
                                                                                                                                                            salt/pillar/__init__.py on lines 566..572

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                    if isinstance(entry, dict):
                                                                                                                                                                                        low_name = next(six.iterkeys(entry))
                                                                                                                                                                                        live['name'] = low_name
                                                                                                                                                                                        list(map(live.update, entry[low_name]))
                                                                                                                                                                                    else:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 3 hrs to fix
                                                                                                                                                            salt/state.py on lines 1443..1448

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                    if isinstance(entry, dict):
                                                                                                                                                                                        low_name = next(six.iterkeys(entry))
                                                                                                                                                                                        live['name'] = low_name
                                                                                                                                                                                        list(map(live.update, entry[low_name]))
                                                                                                                                                                                    else:
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 3 hrs to fix
                                                                                                                                                            salt/state.py on lines 658..663

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                            if 'args' in entry:
                                                                                                                                                                                result = self.functions[entry.pop('fun')](*entry.pop('args'), **entry)
                                                                                                                                                                            else:
                                                                                                                                                                                result = self.functions[entry.pop('fun')](**entry)
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 3 hrs to fix
                                                                                                                                                            salt/state.py on lines 909..912

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                            if 'args' in entry:
                                                                                                                                                                                result = self.functions[entry.pop('fun')](*entry.pop('args'), **entry)
                                                                                                                                                                            else:
                                                                                                                                                                                result = self.functions[entry.pop('fun')](**entry)
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 3 hrs to fix
                                                                                                                                                            salt/state.py on lines 957..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 65.

                                                                                                                                                            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 '.' in _state:
                                                                                                                                                                                                errors.append(
                                                                                                                                                                                                    'Invalid requisite in {0}: {1} for '
                                                                                                                                                                                                    '{2}, in SLS \'{3}\'. Requisites must '
                                                                                                                                                                                                    'not contain dots, did you mean \'{4}\'?'
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 2 hrs to fix
                                                                                                                                                            salt/state.py on lines 1678..1691

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

                                                                                                                                                            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 '.' in pstate:
                                                                                                                                                                                                errors.append(
                                                                                                                                                                                                    'Invalid requisite in {0}: {1} for '
                                                                                                                                                                                                    '{2}, in SLS \'{3}\'. Requisites must '
                                                                                                                                                                                                    'not contain dots, did you mean \'{4}\'?'
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 2 hrs to fix
                                                                                                                                                            salt/state.py on lines 1612..1625

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

                                                                                                                                                            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 exclude:
                                                                                                                                                                            if isinstance(exclude, six.string_types):
                                                                                                                                                                                exclude = exclude.split(',')
                                                                                                                                                                            if '__exclude__' in high:
                                                                                                                                                                                high['__exclude__'].extend(exclude)
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 2 hrs to fix
                                                                                                                                                            salt/client/ssh/wrapper/state.py on lines 196..202

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                    elif status == 'met':
                                                                                                                                                                        if low.get('__prereq__'):
                                                                                                                                                                            self.pre[tag] = self.call(low, chunks, running)
                                                                                                                                                                        else:
                                                                                                                                                                            running[tag] = self.call(low, chunks, running)
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 2 hrs to fix
                                                                                                                                                            salt/state.py on lines 2830..2845

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                    elif status == 'onchanges':
                                                                                                                                                                        start_time, duration = _calculate_fake_duration()
                                                                                                                                                                        running[tag] = {'changes': {},
                                                                                                                                                                                        'result': True,
                                                                                                                                                                                        'duration': duration,
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 2 hrs to fix
                                                                                                                                                            salt/state.py on lines 2750..2754

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

                                                                                                                                                            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

                                                                                                                                                                                     ('The state would be retried every {1} seconds '
                                                                                                                                                                                      '(with a splay of up to {3} seconds) '
                                                                                                                                                                                      'a maximum of {0} times or until a result of {2} '
                                                                                                                                                                                      'is returned').format(low['retry']['attempts'],
                                                                                                                                                                                                            low['retry']['interval'],
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 2 hrs to fix
                                                                                                                                                            salt/runners/digicertapi.py on lines 586..590

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

                                                                                                                                                            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

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

                                                                                                                                                                            try:
                                                                                                                                                                                for tgt in targets:
                                                                                                                                                                                    top[saltenv][tgt] = ctop[saltenv][tgt]
                                                                                                                                                                            except TypeError:
                                                                                                                                                                                raise SaltRenderError('Unable to render top file. No targets found.')
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 2 other locations - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 3387..3391
                                                                                                                                                            salt/state.py on lines 3450..3454

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

                                                                                                                                                            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

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

                                                                                                                                                                                    try:
                                                                                                                                                                                        for tgt in targets:
                                                                                                                                                                                            top[saltenv][tgt] = ctop[saltenv][tgt]
                                                                                                                                                                                    except TypeError:
                                                                                                                                                                                        raise SaltRenderError('Unable to render top file. No targets found.')
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 2 other locations - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 3359..3363
                                                                                                                                                            salt/state.py on lines 3387..3391

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

                                                                                                                                                            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

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

                                                                                                                                                                                try:
                                                                                                                                                                                    for tgt in targets:
                                                                                                                                                                                        top[saltenv][tgt] = ctop[saltenv][tgt]
                                                                                                                                                                                except TypeError:
                                                                                                                                                                                    raise SaltRenderError('Unable to render top file. No targets found.')
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 2 other locations - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 3359..3363
                                                                                                                                                            salt/state.py on lines 3450..3454

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

                                                                                                                                                            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

                                                                                                                                                                    elif status == 'onfail':
                                                                                                                                                                        start_time, duration = _calculate_fake_duration()
                                                                                                                                                                        running[tag] = {'changes': {},
                                                                                                                                                                                        'result': True,
                                                                                                                                                                                        'duration': duration,
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 2830..2840

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                                    if '.' in req_key:
                                                                                                                                                                                                        errors.append(
                                                                                                                                                                                                            'Invalid requisite type \'{0}\' '
                                                                                                                                                                                                            'in state \'{1}\', in SLS '
                                                                                                                                                                                                            '\'{2}\'. Requisite types must '
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 526..536

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                                    if '.' in req_key:
                                                                                                                                                                                                        errors.append((
                                                                                                                                                                                                            'Invalid requisite type \'{0}\' '
                                                                                                                                                                                                            'in state \'{1}\', in SLS '
                                                                                                                                                                                                            '\'{2}\'. Requisite types must '
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 1294..1304

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                def __gather_avail(self):
                                                                                                                                                                    '''
                                                                                                                                                                    Gather the lists of available sls data from the master
                                                                                                                                                                    '''
                                                                                                                                                                    avail = {}
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/pillar/__init__.py on lines 462..469

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                        if chunk['order'] < 0:
                                                                                                                                                                            chunk['order'] = cap + 1000000 + chunk['order']
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 614..615

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                    if isinstance(arg, six.string_types):
                                                                                                                                                                                        fun += 1
                                                                                                                                                                                        if ' ' in arg.strip():
                                                                                                                                                                                            errors.append(('The function "{0}" in state '
                                                                                                                                                                                            '"{1}" in SLS "{2}" has '
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 482..492

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                    if isinstance(arg, six.string_types):
                                                                                                                                                                                        fun += 1
                                                                                                                                                                                        if ' ' in arg.strip():
                                                                                                                                                                                            errors.append(('The function "{0}" in state '
                                                                                                                                                                                            '"{1}" in SLS "{2}" has '
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 1242..1252

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                        if chunk['order'] < 0:
                                                                                                                                                                            chunk['order'] = cap + 1000000 + chunk['order']
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 1391..1392

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                        if 'name_order' in chunk:
                                                                                                                                                                            chunk['order'] = chunk['order'] + chunk.pop('name_order') / 10000.0
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 1389..1390

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                        if 'name_order' in chunk:
                                                                                                                                                                            chunk['order'] = chunk['order'] + chunk.pop('name_order') / 10000.0
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 612..613

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                        if isinstance(entry, six.string_types):
                                                                                                                                                                            cmd = self.functions['cmd.retcode'](
                                                                                                                                                                                entry, ignore_retcode=True, python_shell=True, **cmd_opts)
                                                                                                                                                                            log.debug('Last command return code: %s', cmd)
                                                                                                                                                                            _check_cmd(cmd)
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 947..950

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                        if isinstance(entry, six.string_types):
                                                                                                                                                                            cmd = self.functions['cmd.retcode'](entry, ignore_retcode=True, python_shell=True, **cmd_opts)
                                                                                                                                                                            log.debug('Last command return code: %s', cmd)
                                                                                                                                                                            _check_cmd(cmd)
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 898..902

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                    if 'shell' in self.opts['grains']:
                                                                                                                                                                        cmd_opts['shell'] = self.opts['grains'].get('shell')
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 982..983

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                    if len(comps) >= 2:
                                                                                                                                                                                        # Merge the comps
                                                                                                                                                                                        comps[1] = '.'.join(comps[1:len(comps)])
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 423..425

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                if len(comps) >= 2:
                                                                                                                                                                                    # Merge the comps
                                                                                                                                                                                    comps[1] = '.'.join(comps[1:len(comps)])
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 405..407

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                    if 'shell' in self.opts['grains']:
                                                                                                                                                                        cmd_opts['shell'] = self.opts['grains'].get('shell')
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 857..858

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                    name = (cdata.get('args') or [None])[0] or cdata['kwargs'].get('name')
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 2011..2011

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                        name = (cdata.get('args') or [None])[0] or cdata['kwargs'].get('name')
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 1849..1849

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                                    if not isinstance(req, dict):
                                                                                                                                                                                                        err = ('Requisite declaration {0}'
                                                                                                                                                                                                        ' in SLS {1} is not formed as a'
                                                                                                                                                                                                        ' single key dictionary').format(
                                                                                                                                                                                                            req,
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 1284..1291

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                                    if not isinstance(req, dict):
                                                                                                                                                                                                        err = ('Requisite declaration {0}'
                                                                                                                                                                                                        ' in SLS {1} is not formed as a'
                                                                                                                                                                                                        ' single key dictionary').format(
                                                                                                                                                                                                            req,
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 516..523

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

                                                                                                                                                            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

                                                                                                                                                                                    try:
                                                                                                                                                                                        if value.startswith(SLOT_TEXT):
                                                                                                                                                                                            log.trace("Slot processsing dict value %s", value)
                                                                                                                                                                                            cdata[atype][ind][key] = self.__eval_slot(value)
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 2205..2209

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

                                                                                                                                                            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 isinstance(listvalue, six.text_type):
                                                                                                                                                                                        # Search strings in a list for __slot__:
                                                                                                                                                                                        if listvalue.startswith(SLOT_TEXT):
                                                                                                                                                                                            log.trace("Slot processsing nested string %s", listvalue)
                                                                                                                                                                                            cdata[atype][ind][idx] = self.__eval_slot(listvalue)
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 2185..2188

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                            if len(list(arg)) != 1:
                                                                                                                                                                                                errors.append(
                                                                                                                                                                                                    'Multiple dictionaries defined in '
                                                                                                                                                                                                    'argument of state \'{0}\' in SLS \'{1}\''
                                                                                                                                                                                                    .format(name, body['__sls__'])
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 568..573

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                    compile_template(
                                                                                                                                                                                        contents,
                                                                                                                                                                                        self.state.rend,
                                                                                                                                                                                        self.state.opts['renderer'],
                                                                                                                                                                                        self.state.opts['renderer_blacklist'],
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 3226..3231

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                            if len(list(arg)) != 1:
                                                                                                                                                                                                errors.append(('Multiple dictionaries '
                                                                                                                                                                                                'defined in argument of state \'{0}\' in SLS'
                                                                                                                                                                                                ' \'{1}\'').format(
                                                                                                                                                                                                    name,
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 1334..1338

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

                                                                                                                                                            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

                                                                                                                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                            Open

                                                                                                                                                                                compile_template(
                                                                                                                                                                                    contents,
                                                                                                                                                                                    self.state.rend,
                                                                                                                                                                                    self.state.opts['renderer'],
                                                                                                                                                                                    self.state.opts['renderer_blacklist'],
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 1 other location - About 1 hr to fix
                                                                                                                                                            salt/state.py on lines 3254..3259

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

                                                                                                                                                            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 'fun' not in entry:
                                                                                                                                                                                ret['comment'] = 'no `fun` argument in onlyif: {0}'.format(entry)
                                                                                                                                                                                log.warning(ret['comment'])
                                                                                                                                                                                return ret
                                                                                                                                                            Severity: Minor
                                                                                                                                                            Found in salt/state.py and 1 other location - About 55 mins to fix
                                                                                                                                                            salt/state.py on lines 952..955

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

                                                                                                                                                            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 'fun' not in entry:
                                                                                                                                                                                ret['comment'] = 'no `fun` argument in unless: {0}'.format(entry)
                                                                                                                                                                                log.warning(ret['comment'])
                                                                                                                                                                                return ret
                                                                                                                                                            Severity: Minor
                                                                                                                                                            Found in salt/state.py and 1 other location - About 55 mins to fix
                                                                                                                                                            salt/state.py on lines 904..907

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

                                                                                                                                                            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

                                                                                                                                                                    if not isinstance(low_data['onlyif'], list):
                                                                                                                                                                        low_data_onlyif = [low_data['onlyif']]
                                                                                                                                                                    else:
                                                                                                                                                                        low_data_onlyif = low_data['onlyif']
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 2 other locations - About 50 mins to fix
                                                                                                                                                            salt/state.py on lines 933..936
                                                                                                                                                            salt/utils/schedule.py on lines 986..989

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

                                                                                                                                                            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

                                                                                                                                                                    if not isinstance(low_data['unless'], list):
                                                                                                                                                                        low_data_unless = [low_data['unless']]
                                                                                                                                                                    else:
                                                                                                                                                                        low_data_unless = low_data['unless']
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in salt/state.py and 2 other locations - About 50 mins to fix
                                                                                                                                                            salt/state.py on lines 884..887
                                                                                                                                                            salt/utils/schedule.py on lines 986..989

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

                                                                                                                                                            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 not isinstance(name, six.string_types):
                                                                                                                                                                            errors.append(
                                                                                                                                                                                'ID \'{0}\' in SLS \'{1}\' is not formed as a string, but '
                                                                                                                                                                                'is a {2}. It may need to be quoted.'.format(
                                                                                                                                                                                    name, body['__sls__'], type(name).__name__)
                                                                                                                                                            Severity: Minor
                                                                                                                                                            Found in salt/state.py and 1 other location - About 50 mins to fix
                                                                                                                                                            salt/state.py on lines 455..461

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

                                                                                                                                                            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 not isinstance(name, six.string_types):
                                                                                                                                                                            errors.append(
                                                                                                                                                                                'ID \'{0}\' in SLS \'{1}\' is not formed as a string, but '
                                                                                                                                                                                'is a {2}'.format(
                                                                                                                                                                                    name,
                                                                                                                                                            Severity: Minor
                                                                                                                                                            Found in salt/state.py and 1 other location - About 50 mins to fix
                                                                                                                                                            salt/state.py on lines 1210..1214

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

                                                                                                                                                            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 use_uptime:
                                                                                                                                                                        with salt.utils.files.fopen('/proc/uptime', 'r') as fp_:
                                                                                                                                                                            finish_uptime = float(fp_.readline().split()[0])
                                                                                                                                                            Severity: Minor
                                                                                                                                                            Found in salt/state.py and 1 other location - About 30 mins to fix
                                                                                                                                                            salt/state.py on lines 1873..1874

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

                                                                                                                                                            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

                                                                                                                                                                        with salt.utils.files.fopen('/proc/uptime', 'r') as fp_:
                                                                                                                                                                            start_uptime = float(fp_.readline().split()[0])
                                                                                                                                                            Severity: Minor
                                                                                                                                                            Found in salt/state.py and 1 other location - About 30 mins to fix
                                                                                                                                                            salt/state.py on lines 2047..2049

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

                                                                                                                                                            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