saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

File lxd_container.py has 694 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Manage LXD containers.

.. versionadded:: 2019.2.0
Severity: Major
Found in salt/states/lxd_container.py - About 1 day to fix

    File xapi_virt.py has 692 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    This module (mostly) uses the XenAPI to manage Xen virtual machines.
    
    Big fat warning: the XenAPI used in this file is the one bundled with
    Severity: Major
    Found in salt/modules/xapi_virt.py - About 1 day to fix

      File ipmi.py has 691 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Support IPMI commands over LAN. This module does not talk to the local
      systems hardware through IPMI drivers. It uses a python module `pyghmi`.
      
      
      Severity: Major
      Found in salt/modules/ipmi.py - About 1 day to fix

        Function install has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
        Open

        def install(name=None,
                    refresh=False,
                    pkgs=None,
                    sources=None,
                    slot=None,
        Severity: Minor
        Found in salt/modules/ebuildpkg.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 load_template has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
        Open

        def load_template(template_name=None,
                          template_source=None,
                          context=None,
                          defaults=None,
                          template_engine='jinja',
        Severity: Minor
        Found in salt/modules/napalm_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 _result_to_dict has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
        Open

        def _result_to_dict(data, result, conf, source):
            '''
            Aggregates LDAP search result based on rules, returns a dictionary.
        
            Rules:
        Severity: Minor
        Found in salt/pillar/pillar_ldap.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 win_dacl.py has 688 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Manage DACLs on Windows
        
        :depends:   - winreg Python module
        Severity: Major
        Found in salt/modules/win_dacl.py - About 1 day to fix

          File snapper.py has 687 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Module to manage filesystem snapshots with snapper
          
          .. versionadded:: 2016.11.0
          Severity: Major
          Found in salt/modules/snapper.py - About 1 day to fix

            File cp.py has 686 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Minion side functions for salt-cp
            '''
            
            
            Severity: Major
            Found in salt/modules/cp.py - About 1 day to fix

              Function _routes_present has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
              Open

              def _routes_present(route_table_name, routes, tags=None, region=None, key=None, keyid=None, profile=None):
                  ret = {'name': route_table_name,
                         'result': True,
                         'comment': '',
                         'changes': {}
              Severity: Minor
              Found in salt/states/boto_vpc.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 get has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
              Open

              def get(policy_class=None, return_full_policy_names=True,
                      hierarchical_return=False, adml_language='en-US',
                      return_not_configured=False):
                  '''
                  Get a policy value
              Severity: Minor
              Found in salt/modules/win_lgpo.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 has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
              Open

              def create(vm_=None, call=None):
                  '''
                  Create a single VM from a data dict
                  '''
                  if call:
              Severity: Minor
              Found in salt/cloud/clouds/ec2.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 slack.py has 682 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              An engine that reads messages from Slack and can act on them
              
              .. versionadded: 2016.3.0
              Severity: Major
              Found in salt/engines/slack.py - About 1 day to fix

                File cron.py has 678 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                Work with cron
                
                .. note::
                Severity: Major
                Found in salt/modules/cron.py - About 1 day to fix

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

                  def present(name,
                              password=None,
                              force=False,
                              tags=None,
                              perms=(),
                  Severity: Minor
                  Found in salt/states/rabbitmq_user.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 pg_update has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def pg_update(name, hostgroup=None, host=None, volume=None):
                      '''
                  
                      Update a protection group on a Pure Storage FlashArray.
                  
                  
                  Severity: Minor
                  Found in salt/modules/purefa.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 show_config has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def show_config(jail):
                      '''
                      Display specified jail's configuration
                  
                      CLI Example:
                  Severity: Minor
                  Found in salt/modules/freebsdjail.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 boto3_route53.py has 674 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Manage Route53 records with Boto 3
                  
                  .. versionadded:: 2017.7.0
                  Severity: Major
                  Found in salt/states/boto3_route53.py - About 1 day to fix

                    ThreadLocalProxy has 81 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class ThreadLocalProxy(object):
                        '''
                        Proxy that delegates all operations to its referenced object. The referenced
                        object is hold through a thread-local variable, so that this proxy may refer
                        to different objects in different threads of execution.
                    Severity: Major
                    Found in salt/utils/thread_local_proxy.py - About 1 day to fix

                      File manage.py has 671 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # -*- coding: utf-8 -*-
                      '''
                      General management functions for salt, tools like seeing what hosts are up
                      and what hosts are down
                      '''
                      Severity: Major
                      Found in salt/runners/manage.py - About 1 day to fix
                        Severity
                        Category
                        Status
                        Source
                        Language