saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

File file_tree.py has 440 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
The ``file_tree`` external pillar allows values from all files in a directory
tree to be imported as Pillar data.

Severity: Minor
Found in salt/pillar/file_tree.py - About 6 hrs to fix

    File mongodb.py has 438 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Module to provide MongoDB functionality to Salt
    
    :configuration: This module uses PyMongo, and accepts configuration details as
    Severity: Minor
    Found in salt/modules/mongodb.py - About 6 hrs to fix

      File scripts.py has 438 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      This module contains the function calls to execute command line scripts
      '''
      
      
      Severity: Minor
      Found in salt/scripts.py - About 6 hrs to fix

        _Swagger has 47 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class _Swagger(object):
            '''
            this is a helper class that holds the swagger definition file and the associated logic
            related to how to interpret the file and apply it to AWS Api Gateway.
        
        
        Severity: Minor
        Found in salt/states/boto_apigateway.py - About 6 hrs to fix

          File esxcluster.py has 436 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Manage VMware ESXi Clusters.
          
          Dependencies
          Severity: Minor
          Found in salt/states/esxcluster.py - About 6 hrs to fix

            File netmiko_mod.py has 435 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Netmiko Execution Module
            ========================
            
            
            Severity: Minor
            Found in salt/modules/netmiko_mod.py - About 6 hrs to fix

              Function _find_download_targets has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def _find_download_targets(name=None,
                                         version=None,
                                         pkgs=None,
                                         normalize=True,
                                         skip_suggestions=False,
              Severity: Minor
              Found in salt/states/pkg.py - About 6 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 absent has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def absent(name, uninstall=False):
                  '''
                  Ensure a zone is absent
              
                  name : string
              Severity: Minor
              Found in salt/states/zone.py - About 6 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 private_ips_absent has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def private_ips_absent(name, network_interface_name=None, network_interface_id=None,
                                     private_ip_addresses=None, region=None, key=None, keyid=None, profile=None):
              
                  '''
                  Ensure an ENI does not have secondary private ip addresses associated with it
              Severity: Minor
              Found in salt/states/boto_ec2.py - About 6 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 public_ip_address_present has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def public_ip_address_present(name, resource_group, tags=None, sku=None, public_ip_allocation_method=None,
                                            public_ip_address_version=None, dns_settings=None, idle_timeout_in_minutes=None,
                                            connection_auth=None, **kwargs):
                  '''
                  .. versionadded:: 2019.2.0
              Severity: Minor
              Found in salt/states/azurearm_network.py - About 6 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 list_status has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

                  def list_status(self, match):
                      '''
                      Return a dict of managed keys under a named status
                      '''
                      acc, pre, rej, den = self._check_minions_directories()
              Severity: Minor
              Found in salt/key.py - About 6 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_dacl_inheritance has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def _set_dacl_inheritance(path, objectType, inheritance=True, copy=True, clear=False):
                  '''
                  helper function to set the inheritance
                  Args:
              
              
              Severity: Minor
              Found in salt/modules/win_dacl.py - About 6 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 install has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def install(feature, recurse=False, restart=False, source=None, exclude=None):
                  r'''
                  Install a feature
              
                  .. note::
              Severity: Minor
              Found in salt/modules/win_servermanager.py - About 6 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 mod_repo has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def mod_repo(repo, **kwargs):
                  '''
                  Modify one or more values for a repo.  If the repo does not exist, it will
                  be created, so long as uri is defined.
              
              
              Severity: Minor
              Found in salt/modules/opkg.py - About 6 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 _grant_to_tokens has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def _grant_to_tokens(grant):
                  '''
              
                  This should correspond fairly closely to the YAML rendering of a
                  mysql_grants state which comes out as follows:
              Severity: Minor
              Found in salt/modules/mysql.py - About 6 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 mod_hostname has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def mod_hostname(hostname):
                  '''
                  Modify hostname
              
                  .. versionchanged:: 2015.8.0
              Severity: Minor
              Found in salt/modules/network.py - About 6 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 comment_line has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def comment_line(path,
                               regex,
                               char='#',
                               cmnt=True,
                               backup='.bak'):
              Severity: Minor
              Found in salt/modules/file.py - About 6 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 line has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def line(path, content=None, match=None, mode=None, location=None,
                       before=None, after=None, show_changes=True, backup=False,
                       quiet=False, indent=True):
                  # pylint: disable=W1401
                  '''
              Severity: Minor
              Found in salt/modules/file.py - About 6 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 unzip has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def unzip(zip_file,
                        dest,
                        excludes=None,
                        options=None,
                        template=None,
              Severity: Minor
              Found in salt/modules/archive.py - About 6 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 list_tab has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
              Open

              def list_tab(user):
                  '''
                  Return the contents of the specified user's crontab
              
                  CLI Example:
              Severity: Minor
              Found in salt/modules/cron.py - About 6 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