saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

File boto3_sns.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

:configuration: This module accepts explicit sns credentials but can also
Severity: Minor
Found in salt/modules/boto3_sns.py - About 3 hrs to fix

    File match.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    The match module allows for match routines to be run and determine target specs
    '''
    from __future__ import absolute_import, print_function, unicode_literals
    Severity: Minor
    Found in salt/modules/match.py - About 3 hrs to fix

      File trafficserver.py has 292 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Control Apache Traffic Server
      =============================
      
      
      Severity: Minor
      Found in salt/states/trafficserver.py - About 3 hrs to fix

        File onyx.py has 292 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        State module for Onyx OS Switches Proxy minions
        
        .. versionadded: Neon
        Severity: Minor
        Found in salt/states/onyx.py - About 3 hrs to fix

          File pkgbuild.py has 292 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          The pkgbuild state is the front of Salt package building backend. It
          automatically builds DEB and RPM packages from specified sources
          
          
          Severity: Minor
          Found in salt/states/pkgbuild.py - About 3 hrs to fix

            Client has 26 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Client(object):
                '''
                Base class for Salt file interactions
                '''
                def __init__(self, opts):
            Severity: Minor
            Found in salt/fileclient.py - About 3 hrs to fix

              File consul_pillar.py has 291 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Use Consul K/V as a Pillar source with values parsed as YAML
              
              :depends:  - python-consul
              Severity: Minor
              Found in salt/pillar/consul_pillar.py - About 3 hrs to fix

                Function buildFragment has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    buildFragment: function( elems, context, scripts, selection ) {
                        var j, elem, contains,
                            tmp, tag, tbody, wrap,
                            l = elems.length,
                
                
                Severity: Major
                Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 hrs to fix

                  File mdadm_raid.py has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Salt module to manage RAID arrays with mdadm
                  '''
                  from __future__ import absolute_import, print_function, unicode_literals
                  Severity: Minor
                  Found in salt/modules/mdadm_raid.py - About 2 hrs to fix

                    Function _connect has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _connect(self, timeout=None):
                            '''
                            Connect to a running IPCServer
                            '''
                            if isinstance(self.socket_path, int):
                    Severity: Minor
                    Found in salt/transport/ipc.py - About 2 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 check_existing has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def check_existing(package, pkg_files, formula_def, conn=None):
                        '''
                        Check the filesystem for existing files
                        '''
                        if conn is None:
                    Severity: Minor
                    Found in salt/spm/pkgfiles/local.py - About 2 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 _remove has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _remove(self, args):
                            '''
                            Remove a package
                            '''
                            if len(args) < 2:
                    Severity: Minor
                    Found in salt/spm/__init__.py - About 2 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 returner has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def returner(ret):
                        '''
                        Send an email with the data
                        '''
                    
                    
                    Severity: Minor
                    Found in salt/returners/smtp_return.py - About 2 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 present has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def present(
                            name,
                            subscriptions=None,
                            region=None,
                            key=None,
                    Severity: Minor
                    Found in salt/states/boto_sns.py - About 2 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 halted has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def halted(name, graceful=True):
                        '''
                        Ensure zone is halted
                    
                        name : string
                    Severity: Minor
                    Found in salt/states/zone.py - About 2 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 baseline_snapshot has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def baseline_snapshot(name, number=None, tag=None, include_diff=True, config='root', ignore=None):
                        '''
                        Enforces that no file is modified comparing against a previously
                        defined snapshot identified by number.
                    
                    
                    Severity: Minor
                    Found in salt/states/snapper.py - About 2 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 subnet_present has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def subnet_present(name, address_prefix, virtual_network, resource_group,
                                       security_group=None, route_table=None, connection_auth=None, **kwargs):
                        '''
                        .. versionadded:: 2019.2.0
                    
                    
                    Severity: Minor
                    Found in salt/states/azurearm_network.py - About 2 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 _check_min_max has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _check_min_max(absolute, free, available, used, maximum, minimum, ret):
                        unit = 'KB' if absolute else '%'
                        if minimum is not None:
                            if free:
                                if available < minimum:
                    Severity: Minor
                    Found in salt/states/disk.py - About 2 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 present has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def present(name,
                                protocol=None,
                                service_address=None,
                                scheduler='wlc',
                               ):
                    Severity: Minor
                    Found in salt/states/lvs_service.py - About 2 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 _policies_present has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _policies_present(
                            name,
                            policies=None,
                            region=None,
                            key=None,
                    Severity: Minor
                    Found in salt/states/boto_iam_role.py - About 2 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