saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function set_attributes has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

def set_attributes(path, archive=None, hidden=None, normal=None,
                   notIndexed=None, readonly=None, system=None, temporary=None):
    '''
    Set file attributes for a file.  Note that the normal attribute
    means that all others are false.  So setting it will clear all others.
Severity: Minor
Found in salt/modules/win_file.py - About 4 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_pkgs has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

def list_pkgs(versions_as_list=False,
              include_components=True,
              include_updates=True,
              **kwargs):
    '''
Severity: Minor
Found in salt/modules/win_pkg.py - About 4 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_group has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

def _get_group(conn=None, name=None, vpc_id=None, vpc_name=None, group_id=None,
               region=None, key=None, keyid=None, profile=None):  # pylint: disable=W0613
    '''
    Get a group object given a name, name and vpc_id/vpc_name or group_id. Return
    a boto.ec2.securitygroup.SecurityGroup object if the group is found, else
Severity: Minor
Found in salt/modules/boto_secgroup.py - About 4 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 _atq has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

def _atq(**kwargs):
    '''
    Return match jobs list
    '''

Severity: Minor
Found in salt/modules/at_solaris.py - About 4 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 _format_output has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

def _format_output(kernel_restart, packages, verbose, restartable, nonrestartable, restartservicecommands,
                   restartinitcommands):
    '''
    Formats the output of the restartcheck module.

Severity: Minor
Found in salt/modules/restartcheck.py - About 4 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 query has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

def query(params=None):
    '''
    Make a web call to QingCloud IaaS API.
    '''
    path = 'https://api.qingcloud.com/iaas/'
Severity: Minor
Found in salt/cloud/clouds/qingcloud.py - About 4 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 rename_state_ids has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

def rename_state_ids(data, sls, is_extend=False):
    # if the .sls file is salt://my/salt/file.sls
    # then rename all state ids defined in it that start with a dot(.) with
    # "my.salt.file::" + the_state_id_without_the_first_dot.

Severity: Minor
Found in salt/renderers/stateconf.py - About 4 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 _merge_tops_merge has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def _merge_tops_merge(self, tops):
        '''
        The default merging strategy. The base env is authoritative, so it is
        checked first, followed by the remaining environments. In top files
        from environments other than "base", only the section matching the
Severity: Minor
Found in salt/state.py - About 4 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 apply_exclude has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def apply_exclude(self, high):
        '''
        Read in the __exclude__ list and remove all excluded objects from the
        high data
        '''
Severity: Minor
Found in salt/state.py - About 4 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 load_args_and_kwargs has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

def load_args_and_kwargs(func, args, data=None, ignore_invalid=False):
    '''
    Detect the args and kwargs that need to be passed to a function call, and
    check them against what was passed.
    '''
Severity: Minor
Found in salt/minion.py - About 4 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 modjk.py has 364 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Control Modjk via the Apache Tomcat "Status" worker
(http://tomcat.apache.org/connectors-doc/reference/status.html)

Severity: Minor
Found in salt/modules/modjk.py - About 4 hrs to fix

    File grafana.py has 363 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Manage Grafana Dashboards
    
    This module uses ``elasticsearch``, which can be installed via package, or pip.
    Severity: Minor
    Found in salt/states/grafana.py - About 4 hrs to fix

      File philips_hue.py has 363 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      #
      # Copyright 2015 SUSE LLC
      #
      # Licensed under the Apache License, Version 2.0 (the "License");
      Severity: Minor
      Found in salt/proxy/philips_hue.py - About 4 hrs to fix

        File __init__.py has 362 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        This package contains the loader modules for the salt streams system
        '''
        # Import Python libs
        Severity: Minor
        Found in salt/beacons/__init__.py - About 4 hrs to fix

          File test.py has 361 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Test States
          ===========
          
          
          Severity: Minor
          Found in salt/states/test.py - About 4 hrs to fix

            File mssql.py has 361 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Module to provide MS SQL Server compatibility to salt.
            
            :depends:   - FreeTDS
            Severity: Minor
            Found in salt/modules/mssql.py - About 4 hrs to fix

              File win_network.py has 360 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Configuration of network interfaces on Windows hosts
              ====================================================
              
              
              Severity: Minor
              Found in salt/states/win_network.py - About 4 hrs to fix

                File boto_cloudtrail.py has 360 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                Connection module for Amazon CloudTrail
                
                .. versionadded:: 2016.3.0
                Severity: Minor
                Found in salt/modules/boto_cloudtrail.py - About 4 hrs to fix

                  File mac_power.py has 359 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Module for editing power settings on macOS
                  
                   .. versionadded:: 2016.3.0
                  Severity: Minor
                  Found in salt/modules/mac_power.py - About 4 hrs to fix

                    File solarispkg.py has 359 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -*-
                    '''
                    Package support for Solaris
                    
                    .. important::
                    Severity: Minor
                    Found in salt/modules/solarispkg.py - About 4 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language