saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function _virtual has a Cognitive Complexity of 293 (exceeds 5 allowed). Consider refactoring.
Open

def _virtual(osdata):
    '''
    Returns what type of virtual hardware is under the hood, kvm or physical
    '''
    # This is going to be a monster, if you are running a vm you can test this
Severity: Minor
Found in salt/grains/core.py - About 6 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

File zabbix.py has 2118 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Support for Zabbix

:optdepends:    - zabbix server
Severity: Major
Found in salt/modules/zabbix.py - About 5 days to fix

    File zypperpkg.py has 2069 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Package support for openSUSE via the zypper package manager
    
    :depends: - ``rpm`` Python module.  Install with ``zypper install rpm-python``
    Severity: Major
    Found in salt/modules/zypperpkg.py - About 5 days to fix

      File docker_container.py has 2059 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Management of Docker containers
      
      .. versionadded:: 2017.7.0
      Severity: Major
      Found in salt/states/docker_container.py - About 5 days to fix

        File napalm_network.py has 2052 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        NAPALM Network
        ==============
        
        
        Severity: Major
        Found in salt/modules/napalm_network.py - About 5 days to fix

          Function query has a Cognitive Complexity of 272 (exceeds 5 allowed). Consider refactoring.
          Open

          def query(url,
                    method='GET',
                    params=None,
                    data=None,
                    data_file=None,
          Severity: Minor
          Found in salt/utils/http.py - About 5 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 deploy_script has a Cognitive Complexity of 269 (exceeds 5 allowed). Consider refactoring.
          Open

          def deploy_script(host,
                            port=22,
                            timeout=900,
                            username='root',
                            password=None,
          Severity: Minor
          Found in salt/utils/cloud.py - About 5 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

          File azurearm_network.py has 1998 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Azure (ARM) Network State Module
          
          .. versionadded:: 2019.2.0
          Severity: Major
          Found in salt/states/azurearm_network.py - About 5 days to fix

            File azurearm_network.py has 1987 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Azure (ARM) Network Execution Module
            
            .. versionadded:: 2019.2.0
            Severity: Major
            Found in salt/modules/azurearm_network.py - About 5 days to fix

              Function _present has a Cognitive Complexity of 264 (exceeds 5 allowed). Consider refactoring.
              Open

              def _present(name,
                          block_icmp=None,
                          prune_block_icmp=False,
                          default=None,
                          masquerade=False,
              Severity: Minor
              Found in salt/states/firewalld.py - About 5 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

              File __init__.py has 1962 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              The top level interface used to translate configuration data back to the
              correct cloud modules
              '''
              Severity: Major
              Found in salt/cloud/__init__.py - About 5 days to fix

                File win_dacl.py has 1940 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                ============
                Windows DACL
                ============
                Severity: Major
                Found in salt/utils/win_dacl.py - About 5 days to fix

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

                  # -*- coding: utf-8 -*-
                  '''
                  Interact with Consul
                  
                  https://www.consul.io
                  Severity: Major
                  Found in salt/modules/consul.py - About 5 days to fix

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

                    def present(name,
                                uid=None,
                                gid=None,
                                usergroup=None,
                                groups=None,
                    Severity: Minor
                    Found in salt/states/user.py - About 5 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

                    File master.py has 1891 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -*-
                    '''
                    This module contains all of the routines needed to set up a master server, this
                    involves preparing the three listeners and the workers needed by the master.
                    '''
                    Severity: Major
                    Found in salt/master.py - About 5 days to fix

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

                      # -*- coding: utf-8 -*-
                      '''
                      Control the state system on the minion.
                      
                      State Caching
                      Severity: Major
                      Found in salt/modules/state.py - About 5 days to fix

                        File boto_iam.py has 1858 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        # -*- coding: utf-8 -*-
                        '''
                        Connection module for Amazon IAM
                        
                        .. versionadded:: 2014.7.0
                        Severity: Major
                        Found in salt/modules/boto_iam.py - About 5 days to fix

                          File mysql.py has 1833 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          # -*- coding: utf-8 -*-
                          '''
                          Module to provide MySQL compatibility to salt.
                          
                          :depends:   - MySQLdb Python module
                          Severity: Major
                          Found in salt/modules/mysql.py - About 5 days to fix

                            Function _run has a Cognitive Complexity of 238 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def _run(cmd,
                                     cwd=None,
                                     stdin=None,
                                     stdout=subprocess.PIPE,
                                     stderr=subprocess.PIPE,
                            Severity: Minor
                            Found in salt/modules/cmdmod.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

                            File win_task.py has 1793 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            # -*- coding: utf-8 -*-
                            # https://msdn.microsoft.com/en-us/library/windows/desktop/aa383608(v=vs.85).aspx
                            '''
                            Windows Task Scheduler Module
                            .. versionadded:: 2016.3.0
                            Severity: Major
                            Found in salt/modules/win_task.py - About 4 days to fix
                              Severity
                              Category
                              Status
                              Source
                              Language