saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function init has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

def init(names, host=None, saltcloud_mode=False, quiet=False, **kwargs):
    '''
    Initialize a new container


Severity: Minor
Found in salt/runners/lxc.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 beacon has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

def beacon(config):
    '''
    Read the last wtmp file and return information on the logins
    '''
    ret = []
Severity: Minor
Found in salt/beacons/wtmp.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 six.py has 654 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
"""Utilities for writing code that runs on Python 2 and 3"""

# Copyright (c) 2010-2015 Benjamin Peterson
#
Severity: Major
Found in salt/ext/six.py - About 1 day to fix

    File keystone.py has 650 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Management of Keystone users
    ============================
    
    
    Severity: Major
    Found in salt/states/keystone.py - About 1 day to fix

      Function _install has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
      Open

          def _install(self, args):
              '''
              Install a package from a repo
              '''
              if len(args) < 2:
      Severity: Minor
      Found in salt/spm/__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

      Function security_rule_present has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
      Open

      def security_rule_present(name, access, direction, priority, protocol, security_group, resource_group,
                                destination_address_prefix=None, destination_port_range=None, source_address_prefix=None,
                                source_port_range=None, description=None, destination_address_prefixes=None,
                                destination_port_ranges=None, source_address_prefixes=None, source_port_ranges=None,
                                connection_auth=None, **kwargs):
      Severity: Minor
      Found in salt/states/azurearm_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 load_balancer_present has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
      Open

      def load_balancer_present(name, resource_group, sku=None, frontend_ip_configurations=None, backend_address_pools=None,
                                load_balancing_rules=None, probes=None, inbound_nat_rules=None, inbound_nat_pools=None,
                                outbound_nat_rules=None, tags=None, connection_auth=None, **kwargs):
          '''
          .. versionadded:: 2019.2.0
      Severity: Minor
      Found in salt/states/azurearm_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 serialize has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
      Open

          def serialize(cls, id_=None):
              # The order matters
              serialized = OrderedDict()
              if id_ is not None:
                  # This is meant as a configuration section, sub json schema
      Severity: Minor
      Found in salt/utils/schema.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_ip has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
      Open

      def _interfaces_ip(out):
          '''
          Uses ip 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 query has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
      Open

      def query(key, keyid, method='GET', params=None, headers=None,
                requesturl=None, return_url=False, bucket=None, service_url=None,
                path='', return_bin=False, action=None, local_file=None,
                verify_ssl=True, full_headers=False, kms_keyid=None,
                location=None, role_arn=None, chunk_size=16384, path_style=False,
      Severity: Minor
      Found in salt/utils/s3.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 reconcile_extend has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
      Open

          def reconcile_extend(self, high):
              '''
              Pull the extend data and add it to the respective high data
              '''
              errors = []
      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 virt.py has 649 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

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

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

          File master.py has 648 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
              salt.utils.master
              -----------------
          
          
          Severity: Major
          Found in salt/utils/master.py - About 1 day to fix

            File proxy.py has 645 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            #
            # Proxy minion metaproxy modules
            #
            from __future__ import absolute_import, print_function, with_statement, unicode_literals
            Severity: Major
            Found in salt/metaproxy/proxy.py - About 1 day to fix

              Function _set_line has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
              Open

              def _set_line(lines,
                            content=None,
                            match=None,
                            mode=None,
                            location=None,
              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 map_data has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
              Open

                  def map_data(self, cached=False):
                      '''
                      Create a data map of what to execute on
                      '''
                      ret = {'create': {}}
              Severity: Minor
              Found in salt/cloud/__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 boto_dynamodb.py has 640 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Manage DynamoDB Tables
              ======================
              
              
              Severity: Major
              Found in salt/states/boto_dynamodb.py - About 1 day to fix

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

                # -*- coding: utf-8 -*-
                '''
                Execute calls on selinux
                
                .. note::
                Severity: Major
                Found in salt/modules/selinux.py - About 1 day to fix

                  File github.py has 638 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Github User State Module
                  
                  .. versionadded:: 2016.3.0.
                  Severity: Major
                  Found in salt/states/github.py - About 1 day to fix
                    Severity
                    Category
                    Status
                    Source
                    Language