saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Function present has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
Open

def present(name, params, static_host_list=True, **kwargs):
    '''
    Creates Zabbix Template object or if differs update it according defined parameters. See Zabbix API documentation.

    Zabbix API version: >3.0
Severity: Minor
Found in salt/states/zabbix_template.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_module has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
Open

    def _load_module(self, name):
        mod = None
        fpath, suffix = self.file_mapping[name][:2]
        self.loaded_files.add(name)
        fpath_dirname = os.path.dirname(fpath)
Severity: Minor
Found in salt/loader.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 build_rule has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
Open

def build_rule(table='filter', chain=None, command=None, position='', full=None, family='ipv4',
               **kwargs):
    '''
    Build a well-formatted iptables rule based on kwargs. A `table` and `chain`
    are not required, unless `full` is True.
Severity: Minor
Found in salt/modules/iptables.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_rds.py has 764 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

.. versionadded:: 2015.8.0
Severity: Major
Found in salt/modules/boto_rds.py - About 1 day to fix

    File boto_asg.py has 761 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Connection module for Amazon Autoscale Groups
    
    .. versionadded:: 2014.7.0
    Severity: Major
    Found in salt/modules/boto_asg.py - About 1 day to fix

      Function present has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
      Open

      def present(name,
                  retention_hours=None,
                  enhanced_monitoring=None,
                  num_shards=None,
                  do_reshard=True,
      Severity: Minor
      Found in salt/states/boto_kinesis.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 chassis has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
      Open

      def chassis(name, chassis_name=None, password=None, datacenter=None,
                  location=None, mode=None, idrac_launch=None, slot_names=None,
                  blade_power_states=None):
          '''
          Manage a Dell Chassis.
      Severity: Minor
      Found in salt/states/dellchassis.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 _recv has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
      Open

              def _recv(self, maxsize):
                  rfds = []
                  if self.child_fd:
                      rfds.append(self.child_fd)
                  if self.child_fde:
      Severity: Minor
      Found in salt/utils/vt.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 ext_pillar has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
      Open

      def ext_pillar(minion_id, pillar, resource, sequence, subkey=False, subkey_only=False):
          '''
          Evaluate Pepa templates
          '''
          roots = __opts__['pepa_roots']
      Severity: Minor
      Found in salt/pillar/pepa.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 saltcheck.py has 758 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      A module for testing the logic of states and highstates
      
      :codeauthor:    William Cannon <william.cannon@gmail.com>
      Severity: Major
      Found in salt/modules/saltcheck.py - About 1 day to fix

        File net.py has 758 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        NET Finder
        ==========
        
        
        Severity: Major
        Found in salt/runners/net.py - About 1 day to fix

          File modernizr-2.6.2-respond-1.1.0.js has 755 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* Modernizr 2.6.2 (Custom Build) | MIT & BSD
           * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
           */
          ;
          
          

            File boto_asg.py has 755 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

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

              # -*- coding: utf-8 -*-
              '''
              File server pluggable modules and generic backend functions
              '''
              
              
              Severity: Major
              Found in salt/fileserver/__init__.py - About 1 day to fix

                File hgfs.py has 754 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                Mercurial Fileserver Backend
                
                To enable, add ``hgfs`` to the :conf_master:`fileserver_backend` option in the
                Severity: Major
                Found in salt/fileserver/hgfs.py - About 1 day to fix

                  Function patch has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def patch(name,
                            source=None,
                            source_hash=None,
                            source_hash_name=None,
                            skip_verify=False,
                  Severity: Minor
                  Found in salt/states/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 image_present has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def image_present(name, visibility='public', protected=None,
                          checksum=None, location=None, disk_format='raw', wait_for=None,
                          timeout=30):
                      '''
                      Checks if given image is present with properties
                  Severity: Minor
                  Found in salt/states/glance.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 smartos_vmadm.py has 748 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Module for running vmadm command on SmartOS
                  '''
                  from __future__ import absolute_import, unicode_literals, print_function
                  Severity: Major
                  Found in salt/modules/smartos_vmadm.py - About 1 day to fix

                    Function _check_directory has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _check_directory(name,
                                         user=None,
                                         group=None,
                                         recurse=False,
                                         mode=None,
                    Severity: Minor
                    Found in salt/states/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 record_set_present has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def record_set_present(name, zone_name, resource_group, record_type, if_match=None, if_none_match=None,
                                           etag=None, metadata=None, ttl=None, arecords=None, aaaa_records=None, mx_records=None,
                                           ns_records=None, ptr_records=None, srv_records=None, txt_records=None, cname_record=None,
                                           soa_record=None, caa_records=None, connection_auth=None, **kwargs):
                        '''
                    Severity: Minor
                    Found in salt/states/azurearm_dns.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