saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function spec_check has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def spec_check(self, auth_list, fun, args, form):
        '''
        Check special API permissions
        '''
        if not auth_list:
Severity: Minor
Found in salt/utils/minions.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 render_jinja_tmpl has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

def render_jinja_tmpl(tmplstr, context, tmplpath=None):
    opts = context['opts']
    saltenv = context['saltenv']
    loader = None
    newline = False
Severity: Minor
Found in salt/utils/templates.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 hg_remove has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

def hg_remove(name, volume=None, host=None):
    '''

    Remove a host and/or volume from a hostgroup on a Pure Storage FlashArray.

Severity: Minor
Found in salt/modules/purefa.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 diskusage has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

def diskusage(*args):
    '''
    Return the disk usage for this minion

    Usage::
Severity: Minor
Found in salt/modules/status.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 set_hwclock has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

def set_hwclock(clock):
    '''
    Sets the hardware clock to be either UTC or localtime

    CLI Example:
Severity: Minor
Found in salt/modules/timezone.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 _parse_conf has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_conf(conf_file=_DEFAULT_CONF):
    '''
    Parse a logrotate configuration file.

    Includes will also be parsed, and their configuration will be stored in the
Severity: Minor
Found in salt/modules/logrotate.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 create has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

def create(vm_):
    '''
    Create a single VM from a data dict
    '''
    try:
Severity: Minor
Found in salt/cloud/clouds/softlayer.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 beacon has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

def beacon(config):
    '''
    Poll vmadm for changes
    '''
    ret = []
Severity: Minor
Found in salt/beacons/smartos_vmadm.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 beacon has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

def beacon(config):
    '''
    Broadcast values via zeroconf

    If the announced values are static, it is advised to set run_once: True
Severity: Minor
Found in salt/beacons/avahi_announce.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_master has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def verify_master(self, payload, master_pub=True):
        '''
        Verify that the master is the same one that was previously accepted.

        :param dict payload: The incoming payload. This is a dictionary which may have the following keys:
Severity: Minor
Found in salt/crypt.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

File mine.py has 426 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
The function cache system allows for data to be stored on the master so it can be easily read by other minions
'''

Severity: Minor
Found in salt/modules/mine.py - About 6 hrs to fix

    File libcloudfuncs.py has 426 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    The generic libcloud template used to create the connections and deploy the
    cloud virtual machines
    '''
    Severity: Minor
    Found in salt/cloud/libcloudfuncs.py - About 6 hrs to fix

      File grafana4_dashboard.py has 424 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Manage Grafana v4.0 Dashboards
      
      .. versionadded:: 2017.7.0
      Severity: Minor
      Found in salt/states/grafana4_dashboard.py - About 6 hrs to fix

        File pbm.py has 424 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Manages VMware storage policies
        (called pbm because the vCenter endpoint is /pbm)
        
        
        Severity: Minor
        Found in salt/states/pbm.py - About 6 hrs to fix

          File collector.py has 423 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          #
          # Copyright 2015 SUSE LLC
          #
          # Licensed under the Apache License, Version 2.0 (the "License");
          Severity: Minor
          Found in salt/modules/inspectlib/collector.py - About 6 hrs to fix

            File freebsdpkg.py has 422 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Remote package support using ``pkg_add(1)``
            
            .. important::
            Severity: Minor
            Found in salt/modules/freebsdpkg.py - About 6 hrs to fix

              Function compile_template has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
              Open

              def compile_template(template,
                                   renderers,
                                   default,
                                   blacklist,
                                   whitelist,
              Severity: Minor
              Found in salt/template.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 clean_old_jobs has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
              Open

              def clean_old_jobs():
                  '''
                  Clean out the old jobs from the job cache
                  '''
                  if __opts__['keep_jobs'] != 0:
              Severity: Minor
              Found in salt/returners/local_cache.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 volume_present has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
              Open

              def volume_present(name, volume_name=None, volume_id=None, instance_name=None,
                                 instance_id=None, device=None, size=None, snapshot_id=None,
                                 volume_type=None, iops=None, encrypted=False, kms_key_id=None,
                                 region=None, key=None, keyid=None, profile=None):
                  '''
              Severity: Minor
              Found in salt/states/boto_ec2.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 retention_schedule has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
              Open

              def retention_schedule(name, retain, strptime_format=None, timezone=None):
                  '''
                  Apply retention scheduling to backup storage directory.
              
                  .. versionadded:: 2016.11.0
              Severity: Minor
              Found in salt/states/file.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

              Severity
              Category
              Status
              Source
              Language