saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function _thread_return has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
Open

    def _thread_return(cls, minion_instance, opts, data):
        '''
        This method should be used as a threading target, start the actual
        minion side execution.
        '''
Severity: Minor
Found in salt/minion.py - About 2 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 thread_return has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
Open

def thread_return(cls, minion_instance, opts, data):
    '''
    This method should be used as a threading target, start the actual
    minion side execution.
    '''
Severity: Minor
Found in salt/metaproxy/proxy.py - About 2 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 boto_elb.py has 850 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Connection module for Amazon ELB

.. versionadded:: 2014.7.0
Severity: Major
Found in salt/modules/boto_elb.py - About 2 days to fix

    Function add_trigger has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
    Open

    def add_trigger(name=None,
                    location='\\',
                    trigger_type=None,
                    trigger_enabled=True,
                    start_date=None,
    Severity: Minor
    Found in salt/modules/win_task.py - About 2 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 run_map has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_map(self, dmap):
            '''
            Execute the contents of the VM map
            '''
            if self._has_loop(dmap):
    Severity: Minor
    Found in salt/cloud/__init__.py - About 2 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 nilrt_ip.py has 842 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    The networking module for NI Linux Real-Time distro
    
    '''
    Severity: Major
    Found in salt/modules/nilrt_ip.py - About 2 days to fix

      File pcs.py has 831 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Management of Pacemaker/Corosync clusters with PCS
      ==================================================
      
      
      Severity: Major
      Found in salt/states/pcs.py - About 1 day to fix

        Function _git_run has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
        Open

        def _git_run(command, cwd=None, user=None, password=None, identity=None,
                     ignore_retcode=False, failhard=True, redirect_stderr=False,
                     saltenv='base', output_encoding=None, **kwargs):
            '''
            simple, throw an exception with the error message on an error return code.
        Severity: Minor
        Found in salt/modules/git.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 interfaces has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
        Open

        def interfaces(device=None,
                       interface=None,
                       title=None,
                       pattern=None,
                       ipnet=None,
        Severity: Minor
        Found in salt/runners/net.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 dockercompose.py has 827 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Module to import docker-compose via saltstack
        
        .. versionadded:: 2016.3.0
        Severity: Major
        Found in salt/modules/dockercompose.py - About 1 day to fix

          File azurearm_resource.py has 827 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Azure (ARM) Resource Execution Module
          
          .. versionadded:: 2019.2.0
          Severity: Major
          Found in salt/modules/azurearm_resource.py - About 1 day to fix

            Function call_listen has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring.
            Open

                def call_listen(self, chunks, running):
                    '''
                    Find all of the listen routines and call the associated mod_watch runs
                    '''
                    listeners = []
            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

            Function _refresh_buckets_cache_file has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring.
            Open

            def _refresh_buckets_cache_file(cache_file):
                '''
                Retrieve the content of all buckets and cache the metadata to the buckets
                cache file
                '''
            Severity: Minor
            Found in salt/fileserver/s3fs.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_elasticache.py has 821 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Execution module for Amazon Elasticache using boto3
            ===================================================
            
            
            Severity: Major
            Found in salt/modules/boto3_elasticache.py - About 1 day to fix

              File btrfs.py has 819 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              #
              # Copyright 2014 SUSE LLC
              #
              # Licensed under the Apache License, Version 2.0 (the "License");
              Severity: Major
              Found in salt/modules/btrfs.py - About 1 day to fix

                Function managed has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
                Open

                def managed(name,
                            dns_proto=None,
                            dns_servers=None,
                            ip_proto=None,
                            ip_addrs=None,
                Severity: Minor
                Found in salt/states/win_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

                File oneandone.py has 812 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                1&1 Cloud Server Module
                =======================
                
                
                Severity: Major
                Found in salt/cloud/clouds/oneandone.py - About 1 day to fix

                  File http.py has 810 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Utils for making various web calls. Primarily designed for REST, SOAP, webhooks
                  and the like, but also useful for basic HTTP testing.
                  
                  
                  Severity: Major
                  Found in salt/utils/http.py - About 1 day to fix

                    File aliyun.py has 810 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -*-
                    '''
                    AliYun ECS Cloud Module
                    =======================
                    
                    
                    Severity: Major
                    Found in salt/cloud/clouds/aliyun.py - About 1 day to fix

                      Function get_docker has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def get_docker(interfaces=None, cidrs=None, with_container_id=False):
                          '''
                          .. versionchanged:: 2017.7.8,2018.3.3
                              When :conf_minion:`docker.update_mine` is set to ``False`` for a given
                              minion, no mine data will be populated for that minion, and thus none
                      Severity: Minor
                      Found in salt/modules/mine.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

                      Severity
                      Category
                      Status
                      Source
                      Language