saltstack/salt

View on GitHub

Showing 9,953 of 17,590 total issues

File saltutil.py has 1374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
The Saltutil module is used to manage the state of the salt minion itself. It
is used to manage minion modules as well as automate updates to the salt
minion.
Severity: Major
Found in salt/modules/saltutil.py - About 3 days to fix

    File boto_cloudfront.py has 1344 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Connection module for Amazon CloudFront
    
    .. versionadded:: 2018.3.0
    Severity: Major
    Found in salt/modules/boto_cloudfront.py - About 3 days to fix

      Function verify_high has a Cognitive Complexity of 173 (exceeds 5 allowed). Consider refactoring.
      Open

          def verify_high(self, high):
              '''
              Verify that the high data is viable and follows the data structure
              '''
              errors = []
      Severity: Minor
      Found in salt/state.py - About 3 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 status.py has 1335 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Module for returning various status data about a minion.
      These data can be useful for compiling into stats later.
      '''
      Severity: Major
      Found in salt/modules/status.py - About 3 days to fix

        Function run has a Cognitive Complexity of 171 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self):
                '''
                Execute the salt-cloud command line
                '''
                # Parse shell arguments
        Severity: Minor
        Found in salt/cloud/cli.py - About 3 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 _find_install_targets has a Cognitive Complexity of 168 (exceeds 5 allowed). Consider refactoring.
        Open

        def _find_install_targets(name=None,
                                  version=None,
                                  pkgs=None,
                                  sources=None,
                                  skip_suggestions=False,
        Severity: Minor
        Found in salt/states/pkg.py - About 3 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 _lookup_admin_template has a Cognitive Complexity of 168 (exceeds 5 allowed). Consider refactoring.
        Open

        def _lookup_admin_template(policy_name,
                                   policy_class,
                                   adml_language='en-US'):
            '''
            (success_flag, policy_xml_item, policy_name_list, message)
        Severity: Minor
        Found in salt/modules/win_lgpo.py - About 3 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 resource_present has a Cognitive Complexity of 167 (exceeds 5 allowed). Consider refactoring.
        Open

        def resource_present(name, resource_type, resource_selector_property, resource_selector_value, **kwargs):
            '''
            Ensure resource exists with provided properties
        
            name : string
        Severity: Minor
        Found in salt/states/zone.py - About 3 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 compare_container_networks has a Cognitive Complexity of 167 (exceeds 5 allowed). Consider refactoring.
        Open

        def compare_container_networks(first, second):
            '''
            .. versionadded:: 2018.3.0
        
            Returns the differences between two containers' networks. When a network is
        Severity: Minor
        Found in salt/modules/dockermod.py - About 3 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 kubernetesmod.py has 1297 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Module for handling kubernetes calls.
        
        :optdepends:    - kubernetes Python client
        Severity: Major
        Found in salt/modules/kubernetesmod.py - About 3 days to fix

          Function gen_thin has a Cognitive Complexity of 166 (exceeds 5 allowed). Consider refactoring.
          Open

          def gen_thin(cachedir, extra_mods='', overwrite=False, so_mods='',
                       python2_bin='python2', python3_bin='python3', absonly=True,
                       compress='gzip', extended_cfg=None):
              '''
              Generate the salt-thin tarball and print the location of the tarball
          Severity: Minor
          Found in salt/utils/thin.py - About 3 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 instance_present has a Cognitive Complexity of 165 (exceeds 5 allowed). Consider refactoring.
          Open

          def instance_present(name, instance_name=None, instance_id=None, image_id=None,
                               image_name=None, tags=None, key_name=None,
                               security_groups=None, user_data=None, instance_type=None,
                               placement=None, kernel_id=None, ramdisk_id=None,
                               vpc_id=None, vpc_name=None, monitoring_enabled=None,
          Severity: Minor
          Found in salt/states/boto_ec2.py - About 3 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 esxi.py has 1283 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Manage VMware ESXi Hosts.
          
          .. versionadded:: 2015.8.4
          Severity: Major
          Found in salt/states/esxi.py - About 3 days to fix

            File saltnado.py has 1277 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # encoding: utf-8
            '''
            A non-blocking REST API for Salt
            ================================
            
            
            Severity: Major
            Found in salt/netapi/rest_tornado/saltnado.py - About 3 days to fix

              File opkg.py has 1276 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Support for Opkg
              
              .. important::
              Severity: Major
              Found in salt/modules/opkg.py - About 3 days to fix

                File archive.py has 1275 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                Extract an archive
                
                .. versionadded:: 2014.1.0
                Severity: Major
                Found in salt/states/archive.py - About 3 days to fix

                  Function mksls has a Cognitive Complexity of 163 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def mksls(src, dst=None):
                      '''
                      Convert a kickstart file to an SLS file
                      '''
                      mode = 'command'
                  Severity: Minor
                  Found in salt/utils/kickstart.py - About 3 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 linode.py has 1268 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Linode Cloud Module using Linode's REST API
                  ===========================================
                  
                  
                  Severity: Major
                  Found in salt/cloud/clouds/linode.py - About 3 days to fix

                    File crypt.py has 1259 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -*-
                    '''
                    The crypt module manages all of the cryptography functions for minions and
                    masters, encrypting and decrypting payloads, preparing messages, and
                    authenticating peers
                    Severity: Major
                    Found in salt/crypt.py - About 3 days to fix

                      Function mod_repo has a Cognitive Complexity of 160 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def mod_repo(repo, saltenv='base', **kwargs):
                          '''
                          Modify one or more values for a repo.  If the repo does not exist, it will
                          be created, so long as the definition is well formed.  For Ubuntu the
                          ``ppa:<project>/repo`` format is acceptable. ``ppa:`` format can only be
                      Severity: Minor
                      Found in salt/modules/aptpkg.py - About 3 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

                      Severity
                      Category
                      Status
                      Source
                      Language