saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function present has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

def present(name, value, hostid=None, **kwargs):
    '''
    Creates a new usermacro.

    :param name: name of the usermacro
Severity: Minor
Found in salt/states/zabbix_usermacro.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

Function prep_trans_tar has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

def prep_trans_tar(file_client, chunks, file_refs, pillar=None, id_=None, roster_grains=None):
    '''
    Generate the execution package from the saltenv file refs and a low state
    data structure
    '''
Severity: Minor
Found in salt/client/ssh/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

Function create_datagram_endpoint has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

    def create_datagram_endpoint(loop, protocol_factory, local_addr=None, remote_addr=None, family=0, proto=0, flags=0):
        '''
        Create datagram connection.

        Based on code from Python 3.5 version, this method is used
Severity: Minor
Found in salt/utils/ssdp.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

Function _post_processing has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

def _post_processing(kwargs, skip_translate, invalid):
    '''
    Additional container-specific post-translation processing
    '''
    # Don't allow conflicting options to be set
Severity: Minor
Found in salt/utils/docker/translate/container.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

Function set_auth_key has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

def set_auth_key(
        user,
        key,
        enc='ssh-rsa',
        comment='',
Severity: Minor
Found in salt/modules/ssh.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

Function beacon has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

def beacon(config):
    '''
    Watch for changes on network settings

    By default, the beacon will emit when there is a value change on one of the
Severity: Minor
Found in salt/beacons/network_settings.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

File statuspage.py has 480 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

'''
StatusPage
==========
Severity: Minor
Found in salt/states/statuspage.py - About 7 hrs to fix

    File boto_datapipeline.py has 480 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Manage Data Pipelines
    
    .. versionadded:: 2016.3.0
    Severity: Minor
    Found in salt/states/boto_datapipeline.py - About 7 hrs to fix

      File system.py has 478 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Support for reboot, shutdown, etc on POSIX-like systems.
      
      .. note::
      Severity: Minor
      Found in salt/modules/system.py - About 7 hrs to fix

        File lxc.py has 477 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Install Salt on an LXC Container
        ================================
        
        
        Severity: Minor
        Found in salt/cloud/clouds/lxc.py - About 7 hrs to fix

          File jobs.py has 477 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          A convenience system to manage jobs, both active and already run
          '''
          
          
          Severity: Minor
          Found in salt/runners/jobs.py - About 7 hrs to fix

            File runit.py has 476 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            runit service module
            (http://smarden.org/runit)
            
            
            Severity: Minor
            Found in salt/modules/runit.py - About 7 hrs to fix

              Function mknod has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

              def mknod(name, ntype, major=0, minor=0, user=None, group=None, mode='0600'):
                  '''
                  Create a special file similar to the 'nix mknod command. The supported
                  device types are ``p`` (fifo pipe), ``c`` (character device), and ``b``
                  (block device). Provide the major and minor numbers when specifying a
              Severity: Minor
              Found in salt/states/file.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

              Function ntp_configured has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

              def ntp_configured(name,
                                 service_running,
                                 ntp_servers=None,
                                 service_policy=None,
                                 service_restart=False,
              Severity: Minor
              Found in salt/states/esxi.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

              Function syslog has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

              def syslog(name, primary=None, secondary=None):
                  '''
                  Ensures that the syslog servers are set to the specified values. A value of None will be ignored.
              
                  name: The name of the module function to execute.
              Severity: Minor
              Found in salt/states/cimc.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

              Function _available_services has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

              def _available_services(refresh=False):
                  '''
                  This is a helper function for getting the available macOS services.
              
                  The strategy is to look through the known system locations for
              Severity: Minor
              Found in salt/utils/mac_utils.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

              Function network_interface_create_or_update has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

              def network_interface_create_or_update(name, ip_configurations, subnet, virtual_network,
                                                     resource_group, **kwargs):
                  '''
                  .. versionadded:: 2019.2.0
              
              
              Severity: Minor
              Found in salt/modules/azurearm_network.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

              Function modify has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

              def modify(name,
                         bin_path=None,
                         exe_args=None,
                         display_name=None,
                         description=None,
              Severity: Minor
              Found in salt/modules/win_service.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

              Function modify has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

              def modify(
                  login, password=None, password_hashed=False,
                  domain=None, profile=None, script=None,
                  drive=None, homedir=None, fullname=None,
                  account_desc=None, account_control=None,
              Severity: Minor
              Found in salt/modules/pdbedit.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

              Function make_repo has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

              def make_repo(repodir,
                            keyid=None,
                            env=None,
                            use_passphrase=False,
                            gnupghome='/etc/salt/gpgkeys',
              Severity: Minor
              Found in salt/modules/rpmbuild_pkgbuild.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

              Severity
              Category
              Status
              Source
              Language