saltstack/salt

View on GitHub

Showing 9,400 of 17,590 total issues

Avoid deeply nested control flow statements.
Open

                        if not func(path_mode):
                            incorrect_type.append(path)
                    except OSError as exc:
Severity: Major
Found in salt/states/archive.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if not pipsearch:
                            pkg_404_comms.append(
                                'There was no error installing package \'{0}\' '
                                'although it does not show when calling '
                                '\'pip.freeze\'.'.format(pkg)
    Severity: Major
    Found in salt/states/pip_state.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if pre_comments != post_comments:
                              break
                  elif kwarg == 'comments' and __grains__['os_family'] in ('RedHat', 'VMware Photon'):
      Severity: Major
      Found in salt/states/pkgrepo.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if version is not None:
                                pkgs.append({chunk['name']: version})
                            else:
                                pkgs.append(chunk['name'])
                            chunk['__agg__'] = True
        Severity: Major
        Found in salt/states/pip_state.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if six.text_type(sanitizedkwargs[kwarg]) != six.text_type(pre[kwarg]):
                                  break
                  else:
          Severity: Major
          Found in salt/states/pkgrepo.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if route_table_id:
                                    route_table_found = True
                                    route_table_desc = __salt__['boto_vpc.describe_route_table'](route_table_id=route_table_id,
                                                                                                 region=region, key=key, keyid=keyid,
                                                                                                 profile=profile)
            Severity: Major
            Found in salt/states/boto_vpc.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if 'a' in spec[1]:
                                      include_alpha = True
                                  if 'b' in spec[1]:
              Severity: Major
              Found in salt/states/pip_state.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    for p in ('profile', 'key', 'keyid', 'region', 'wait_for_sync'):
                                        cname[p] = locals().get(p) if p not in cname else cname[p]
                                _ret = __states__['boto_route53.present'](**cname)
                Severity: Major
                Found in salt/states/boto_elb.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if 'tags' in lb:
                                          if lb['tags']:
                                              if tag in lb['tags']:
                                                  ret['changes']['old']['tags'][tag] = lb['tags'][tag]
                          if not tags_to_update and not tags_to_remove and not tags_to_add:
                  Severity: Major
                  Found in salt/states/boto_elb.py - About 45 mins to fix

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

                    def _alarms_present(name, alarms, alarms_from_pillar, region, key, keyid, profile):
                        '''helper method for present.  ensure that cloudwatch_alarms are set'''
                        current = __salt__['config.option'](alarms_from_pillar, {})
                        if alarms:
                            current = salt.utils.dictupdate.update(current, alarms)
                    Severity: Minor
                    Found in salt/states/boto_elb.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 __grains__['os_family'] in ('RedHat', 'VMware Photon'):
                                            if not salt.utils.data.is_true(sanitizedkwargs[kwarg]):
                                                break
                                        else:
                                            break
                    Severity: Major
                    Found in salt/states/pkgrepo.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if _fulfills_version_spec(version, version_spec):
                                              desired_version = version
                                              break
                                  else:
                      Severity: Major
                      Found in salt/states/pip_state.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if not any(
                                                [
                                                    line.strip().startswith(x)
                                                    for x in PIP_REQUIREMENTS_NOCHANGE
                                                ]
                        Severity: Major
                        Found in salt/states/pip_state.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if tags[_tag] != lb['tags'][_tag]:
                                                  tags_to_update[_tag] = tags[_tag]
                                              tags_to_add.pop(_tag)
                          Severity: Major
                          Found in salt/states/boto_elb.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if 'rc' in spec[1]:
                                                    include_rc = True
                                        available_versions = __salt__['pip.list_all_versions'](
                            Severity: Major
                            Found in salt/states/pip_state.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if 'changes' in result:
                                                      ret['comment'].append('Modifying {0} in beacons'.format(name))
                                                      ret['changes'] = result['changes']
                                                  else:
                                                      ret['comment'].append(result['comment'])
                              Severity: Major
                              Found in salt/states/beacon.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if 'b' in spec[1]:
                                                        include_beta = True
                                                    if 'rc' in spec[1]:
                                Severity: Major
                                Found in salt/states/pip_state.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if _tag not in tags_to_remove:
                                                          tags_to_remove.append(_tag)
                                                  else:
                                  Severity: Major
                                  Found in salt/states/boto_elb.py - About 45 mins to fix

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

                                    def min_party(name,
                                                  zk_hosts,
                                                  min_nodes,
                                                  blocking=False,
                                                  profile=None,
                                    Severity: Minor
                                    Found in salt/states/zk_concurrency.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 _device in active:
                                                            _real_device = active[_device]['device']
                                                            opts = list(set(opts + active[_device]['opts'] + active[_device]['superopts']))
                                                            active[real_name]['opts'].append('bind')
                                                            break
                                    Severity: Major
                                    Found in salt/states/mount.py - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language