saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function _interfaces_ifconfig has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
Open

def _interfaces_ifconfig(out):
    '''
    Uses ifconfig to return a dictionary of interfaces with various information
    about each (up/down state, ip address, netmask, and hwaddr)
    '''
Severity: Minor
Found in salt/utils/network.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 append_to_package_conf has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
Open

def append_to_package_conf(conf, atom='', flags=None, string='', overwrite=False):
    '''
    Append a string or a list of flags for a given package or DEPEND atom to a
    given configuration file.

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

File napalm_netacl.py has 745 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
NAPALM ACL
==========

Severity: Major
Found in salt/modules/napalm_netacl.py - About 1 day to fix

    File debuild_pkgbuild.py has 743 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Debian Package builder system
    
    .. versionadded:: 2015.8.0
    Severity: Major
    Found in salt/modules/debuild_pkgbuild.py - About 1 day to fix

      Function installed has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
      Open

      def installed(name, target="LocalSystem", dmg=False, store=False, app=False, mpkg=False, user=None, onlyif=None,
                    unless=None, force=False, allow_untrusted=False, version_check=None):
          '''
          Install a Mac OS Package from a pkg or dmg file, if given a dmg file it
          will first be mounted in a temporary location
      Severity: Minor
      Found in salt/states/macpackage.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

      File nftables.py has 738 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Support for nftables
      '''
      from __future__ import absolute_import, print_function, unicode_literals
      Severity: Major
      Found in salt/modules/nftables.py - About 1 day to fix

        File thin.py has 736 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Generate the salt thin tarball from the installed python files
        '''
        
        
        Severity: Major
        Found in salt/utils/thin.py - About 1 day to fix

          File heat.py has 734 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Module for handling OpenStack Heat calls
          
          .. versionadded:: 2017.7.0
          Severity: Major
          Found in salt/modules/heat.py - About 1 day to fix

            Function info has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
            Open

            def info(*packages, **kwargs):
                '''
                Return a detailed package(s) summary information.
                If no packages specified, all packages will be returned.
            
            
            Severity: Minor
            Found in salt/modules/rpm_lowpkg.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 merge_tops has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
            Open

                def merge_tops(self, tops):
                    '''
                    Cleanly merge the top files
                    '''
                    top = collections.defaultdict(OrderedDict)
            Severity: Minor
            Found in salt/pillar/__init__.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

            File netconfig.py has 729 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Network Config
            ==============
            
            
            Severity: Major
            Found in salt/states/netconfig.py - About 1 day to fix

              File boto_s3_bucket.py has 729 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Connection module for Amazon S3 Buckets
              
              .. versionadded:: 2016.3.0
              Severity: Major
              Found in salt/modules/boto_s3_bucket.py - About 1 day to fix

                Function shortcut has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
                Open

                def shortcut(
                        name,
                        target,
                        arguments=None,
                        working_dir=None,
                Severity: Minor
                Found in salt/states/file.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 recurse has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
                Open

                def recurse(name,
                            source,
                            keep_source=True,
                            clean=False,
                            require=None,
                Severity: Minor
                Found in salt/states/file.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 source_list has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
                Open

                def source_list(source, source_hash, saltenv):
                    '''
                    Check the source list and return the source to use
                
                    CLI Example:
                Severity: Minor
                Found in salt/modules/file.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 create_certificate has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
                Open

                def create_certificate(
                        path=None, text=False, overwrite=True, ca_server=None, **kwargs):
                    '''
                    Create an X509 certificate.
                
                
                Severity: Minor
                Found in salt/modules/x509.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 container_file_put has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
                Open

                def container_file_put(name, src, dst, recursive=False, overwrite=False,
                                       mode=None, uid=None, gid=None, saltenv='base',
                                       remote_addr=None,
                                       cert=None, key=None, verify_cert=True):
                    '''
                Severity: Minor
                Found in salt/modules/lxd.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

                File osquery.py has 724 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                Support for OSQuery - https://osquery.io.
                
                .. versionadded:: 2015.8.0
                Severity: Major
                Found in salt/modules/osquery.py - About 1 day to fix

                  File useradd.py has 722 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Manage users with the useradd command
                  
                  .. important::
                  Severity: Major
                  Found in salt/modules/useradd.py - About 1 day to fix
                    Severity
                    Category
                    Status
                    Source
                    Language