saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Avoid deeply nested control flow statements.
Open

                    if mount:
                        comment = ('{0} is mounted, but its fstab entry '
                                          'must be updated.').format(name)
                    else:
                        comment = ('The {0} fstab entry '
Severity: Major
Found in salt/states/mount.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if current_member['name'] == member['name']:
                            added_member = current_member
                            break
    
    
    Severity: Major
    Found in salt/states/bigip.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if 'result' in result and not result['result']:
                              ret['result'] = result['result']
                              ret['comment'].append(result['comment'])
                          else:
                              ret['comment'].append('Set trust level for {0} to {1}'.format(key, trust))
      Severity: Major
      Found in salt/states/gpg.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if keyval_option in mount_invisible_keys:
                                opt = keyval_option
        
        
        Severity: Major
        Found in salt/states/mount.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if size_match:
                                  converted_size = _size_convert(size_match)
                                  opt = "size={0}k".format(converted_size)
                              # make cifs option user synonym for option username which is reported by /proc/mounts
                              if fstype in ['cifs'] and opt.split('=')[0] == 'user':
          Severity: Major
          Found in salt/states/mount.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if opt.split('=')[0] in name_id_opts and len(opt.split('=')) > 1:
                                    _givenid = opt.split('=')[1]
                                    _param = opt.split('=')[0]
                                    _id = _givenid
                                    if not re.match('[0-9]+$', _givenid):
            Severity: Major
            Found in salt/states/mount.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if args['type'] == 'password':
                                      ret['changes'][key] = '(password hidden)'
                                  else:
                                      ret['changes'][key] = ('{0}').format(args['value'])
                              else:
              Severity: Major
              Found in salt/states/debconfmod.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if current_keys[key]['trust'] != TRUST_MAP[trust]:
                                        # update trust level
                                        result = __salt__['gpg.trust_key'](keyid=key,
                                                                           trust_level=trust,
                                                                           user=user,
                Severity: Major
                Found in salt/states/gpg.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if _missing:
                                          if __opts__['test']:
                                              ret['result'] = None
                                              ret['comment'] = ('Remount would be forced because'
                                                                ' options ({0})'
                  Severity: Major
                  Found in salt/states/mount.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if opt in mount_translate_options:
                                            opt = mount_translate_options[opt]
                    
                    
                    Severity: Major
                    Found in salt/states/mount.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if mount:
                                              comment = ('{0} is mounted, but needs to be '
                                                                'written to the fstab in order to be '
                                                                'made persistent.').format(name)
                                          else:
                      Severity: Major
                      Found in salt/states/mount.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if fstype in ['cifs'] and opt.split('=')[0] == 'user':
                                                opt = "username={0}".format(opt.split('=')[1])
                        
                        
                        Severity: Major
                        Found in salt/states/mount.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if opt.split('=')[0] in mount_ignore_fs_keys.get(fstype, []):
                                                  opt = opt.split('=')[0]
                          
                                              # convert uid/gid to numeric value from user/group name
                                              name_id_opts = {'uid': 'user.info',
                          Severity: Major
                          Found in salt/states/mount.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                for _active_opt in _active_superopts:
                                                    size_match = re.match(r'size=(?P<size_value>[0-9]+)(?P<size_unit>k|m|g)', _active_opt)
                                                    if size_match:
                                                        converted_size = _size_convert(size_match)
                                                        opt = "size={0}k".format(converted_size)
                            Severity: Major
                            Found in salt/states/mount.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if real_name in active:
                                                      ret['comment'] = "Unable to unmount"
                                                      ret['result'] = None
                                                      return ret
                                                  update_mount_cache = True
                              Severity: Major
                              Found in salt/states/mount.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if real_device != device:
                                                        ret['changes']['umount'] += " (" + real_device + ")"
                                                    ret['changes']['umount'] += ", current: " + ', '.join(device_list)
                                Severity: Major
                                Found in salt/states/mount.py - About 45 mins to fix

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

                                  def present(name,
                                              passwd,
                                              database=None,
                                              user=None,
                                              password=None,
                                  Severity: Minor
                                  Found in salt/states/influxdb08_user.py - About 45 mins 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

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if opt not in active[real_name]['opts'] \
                                                      and opt not in _active_superopts \
                                                      and opt not in mount_invisible_options \
                                                      and opt not in mount_ignore_fs_keys.get(fstype, []) \
                                                      and opt not in mount_invisible_keys:
                                  Severity: Major
                                  Found in salt/states/mount.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if output:
                                                                ret['comment'] = 'Successfully updated index template {0}'.format(name)
                                                                ret['changes'] = diff
                                                            else:
                                                                ret['result'] = False
                                    Severity: Major
                                    Found in salt/states/elasticsearch.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          for _device in device_list:
                                                              if re.match(regex, _device):
                                                                  _device_mismatch_is_ignored = _device
                                                                  break
                                                      if _device_mismatch_is_ignored:
                                      Severity: Major
                                      Found in salt/states/mount.py - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language