saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

File ceph.py has 501 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Module to provide ceph control with salt.

:depends:   - ceph_cfg Python module
Severity: Major
Found in salt/modules/ceph.py - About 1 day to fix

    File restartcheck.py has 499 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    checkrestart functionality for Debian and Red Hat Based systems
    
    Identifies services (processes) that are linked against deleted files (for example after downloading an updated
    Severity: Minor
    Found in salt/modules/restartcheck.py - About 1 day to fix

      File verify.py has 498 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      A few checks to make sure the environment is sane
      '''
      from __future__ import absolute_import, print_function, unicode_literals
      Severity: Minor
      Found in salt/utils/verify.py - About 7 hrs to fix

        File selinux.py has 497 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Management of SELinux rules
        ===========================
        
        
        Severity: Minor
        Found in salt/states/selinux.py - About 7 hrs to fix

          Function policy_definition_present has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

          def policy_definition_present(name, policy_rule=None, policy_type=None, mode=None, display_name=None, description=None,
                                        metadata=None, parameters=None, policy_rule_json=None, policy_rule_file=None,
                                        template='jinja', source_hash=None, source_hash_name=None, skip_verify=False,
                                        connection_auth=None, **kwargs):
              '''
          Severity: Minor
          Found in salt/states/azurearm_resource.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 blade_idrac has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

          def blade_idrac(name, idrac_password=None, idrac_ipmi=None,
                          idrac_ip=None, idrac_netmask=None, idrac_gateway=None,
                          idrac_dnsname=None,
                          idrac_dhcp=None):
              '''
          Severity: Minor
          Found in salt/states/dellchassis.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 present has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

          def present(name,
                      passwd,
                      admin=False,
                      grants=None,
                      **client_args):
          Severity: Minor
          Found in salt/states/influxdb_user.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 host_cache_configured has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

          def host_cache_configured(name, enabled, datastore, swap_size='100%',
                                    dedicated_backing_disk=False,
                                    erase_backing_disk=False):
              '''
              Configures the host cache used for swapping.
          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 _set_perms has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

          def _set_perms(obj_dacl, obj_type, new_perms, cur_perms, access_mode):
              obj_type = obj_type.lower()
              ret = {}
              for user in new_perms:
                  # Check that user exists:
          Severity: Minor
          Found in salt/utils/win_dacl.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 parse_resolv has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

          def parse_resolv(src='/etc/resolv.conf'):
              '''
              Parse a resolver configuration file (traditionally /etc/resolv.conf)
              '''
          
          
          Severity: Minor
          Found in salt/utils/dns.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 cpustats has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

          def cpustats():
              '''
              Return the CPU stats for this minion
          
              .. versionchanged:: 2016.11.4
          Severity: Minor
          Found in salt/modules/status.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 get_resource_records has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_resource_records(HostedZoneId=None, Name=None, StartRecordName=None,
                                   StartRecordType=None, PrivateZone=None,
                                   region=None, key=None, keyid=None, profile=None):
              '''
              Get all resource records from a given zone matching the provided StartRecordName (if given) or all
          Severity: Minor
          Found in salt/modules/boto3_route53.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 sync_config_devices has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

          def sync_config_devices(obj, newconfig, newdevices, test=False):
              ''' Syncs the given config and devices with the object
                  (a profile or a container)
                  returns a changes dict with all changes made.
          
          
          Severity: Minor
          Found in salt/modules/lxd.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_network_interface has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

          def create_network_interface(call=None, kwargs=None):
              '''
              Create a network interface.
              '''
              if call != 'action':
          Severity: Minor
          Found in salt/cloud/clouds/azurearm.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 pkgin.py has 496 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Package support for pkgin based systems, inspired from freebsdpkg module
          
          .. important::
          Severity: Minor
          Found in salt/modules/pkgin.py - About 7 hrs to fix

            File stringutils.py has 492 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Functions for manipulating or otherwise processing strings
            '''
            
            
            Severity: Minor
            Found in salt/utils/stringutils.py - About 7 hrs to fix

              File pepa.py has 492 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              #!/usr/bin/env python
              # -*- coding: utf-8 -*-
              '''
              Pepa
              ====
              Severity: Minor
              Found in salt/pillar/pepa.py - About 7 hrs to fix

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

                # -*- coding: utf-8 -*-
                '''
                Control Linux Containers via Salt
                
                :depends: lxc execution module
                Severity: Minor
                Found in salt/runners/lxc.py - About 7 hrs to fix

                  Function exists has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def exists(name, index=None):
                      '''
                      Add the directory to the system PATH at index location
                  
                      index
                  Severity: Minor
                  Found in salt/states/win_path.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 present has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def present(name,
                              running=None,
                              source=None,
                              profiles=None,
                              config=None,
                  Severity: Minor
                  Found in salt/states/lxd_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

                  Severity
                  Category
                  Status
                  Source
                  Language