saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

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

def statelist(states_dict, sid_excludes=frozenset(['include', 'exclude'])):
    for sid, states in six.iteritems(states_dict):
        if sid.startswith('__'):
            continue
        if sid in sid_excludes:
Severity: Minor
Found in salt/renderers/stateconf.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 salt_ip_verify_tool has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def salt_ip_verify_tool():
    '''
    If there is a list of restricted IPs, verify current
    client is coming from one of those IPs.
    '''
Severity: Minor
Found in salt/netapi/rest_cherrypy/app.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 process has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def process(self, salt_data, token, opts):
        '''
        Process events and publish data
        '''
        log.debug('In process %s', threading.current_thread())
Severity: Minor
Found in salt/netapi/rest_tornado/event_processor.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 GET has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def GET(self, jid=None, timeout=''):
        '''
        A convenience URL for getting lists of previously run jobs or getting
        the return from a single job

Severity: Minor
Found in salt/netapi/rest_cherrypy/app.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 ext_pillar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def ext_pillar(minion_id,
               pillar,
               api_url,
               email,
               secret_key,
Severity: Minor
Found in salt/pillar/nsot.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 _get_platforms has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _get_platforms(data):
    platform_list = []
    for item in data:
        if item.startswith('PlatformEdit.html?'):
            parameter_list = item.split('PlatformEdit.html?', 1)[1].split('&')
Severity: Minor
Found in salt/runners/asam.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 _process_stack_cfg has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _process_stack_cfg(cfg, stack, minion_id, pillar):
    log.debug('Config: %s', cfg)
    basedir, filename = os.path.split(cfg)
    jenv = Environment(loader=FileSystemLoader(basedir), extensions=['jinja2.ext.do', salt.utils.jinja.SerializerExtension])
    jenv.globals.update({
Severity: Minor
Found in salt/pillar/stack.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 ext_pillar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def ext_pillar(minion_id, pillar, include, extra_minion_data=None):

    def get_subtree(key, source_dict):
        '''
        Returns a subtree corresponfing to the specified key.
Severity: Minor
Found in salt/pillar/extra_minion_data_in_pillar.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 _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 check_find_job has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def check_find_job(self, minions):
        did_not_return = minions.difference(self.find_job_returned)
        if did_not_return:
            for minion in did_not_return:
                if minion in self.find_job_returned:
Severity: Minor
Found in salt/cli/batch_async.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 fqdns has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def fqdns():
    '''
    Return all known FQDNs for the system by enumerating all interfaces and
    then trying to reverse resolve them (excluding 'lo' interface).
    '''
Severity: Minor
Found in salt/grains/core.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 _bsd_memdata has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _bsd_memdata(osdata):
    '''
    Return the memory information for BSD-like systems
    '''
    grains = {'mem_total': 0, 'swap_total': 0}
Severity: Minor
Found in salt/grains/core.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 get_profile has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def get_profile(profile, caller, runner):
    '''
    Get profile.

    :param profile:
Severity: Minor
Found in salt/cli/support/__init__.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 _find_credentials has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _find_credentials():
    '''
    Cycle through all the possible credentials and return the first one that
    works
    '''
Severity: Minor
Found in salt/grains/fx2.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 _smartos_zone_pkgin_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _smartos_zone_pkgin_data():
    '''
    SmartOS zone pkgin information
    '''
    # Provides:
Severity: Minor
Found in salt/grains/smartos.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 master_config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def master_config(path, env_var='SALT_MASTER_CONFIG', defaults=None, exit_on_config_errors=False):
    '''
    Reads in the master configuration file and sets up default options

    This is useful for running the actual master daemon. For running
Severity: Minor
Found in salt/config/__init__.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 target has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def target(cls, minion_instance, opts, data, connected):

    if not minion_instance:
        minion_instance = cls(opts)
        minion_instance.connected = connected
Severity: Minor
Found in salt/metaproxy/proxy.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 beacon has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def beacon(config):
    '''
    Check if current number of sessions of a server for a specific haproxy backend
    is over a defined threshold.

Severity: Minor
Found in salt/beacons/haproxy.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

Severity
Category
Status
Source
Language