18F/State-TalentMAP-API

View on GitHub

Showing 40 of 40 total issues

Function bidcycle_positions_update has 7 arguments (exceeds 5 allowed). Consider refactoring.
Open

def bidcycle_positions_update(sender, instance, action, reverse, model, pk_set, **kwargs):
Severity: Major
Found in talentmap_api/bidding/models.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

    with client.options(timeout=int(get_delineated_environment_variable('SOAP_TIMEOUT', 180))):
    response_xml = ET.tostring(getattr(client.service, soap_function_name)(**soap_arguments), encoding="unicode")
    except TimeoutException as e:
    Severity: Major
    Found in talentmap_api/integrations/models.py - About 45 mins to fix

      Function mode_cycles has a Cognitive Complexity of 10 (exceeds 7 allowed). Consider refactoring.
      Open

      def mode_cycles(last_updated_date=None):
      # Request data
      soap_arguments = {
      "RequestorID": "TalentMAP",
      "Action": "GET",
      Severity: Minor
      Found in talentmap_api/integrations/synchronization_helpers.py - About 45 mins to fix

      Function waiver_status_changed has a Cognitive Complexity of 10 (exceeds 7 allowed). Consider refactoring.
      Open

      def waiver_status_changed(sender, instance, **kwargs):
      notification_bodies = instance.generate_status_messages()
       
      # If our instance has an id, we're performing an update (and not a create)
      if instance.id:
      Severity: Minor
      Found in talentmap_api/bidding/models.py - About 45 mins to fix

      Function __init__ has 7 arguments (exceeds 5 allowed). Consider refactoring.
      Open

      def __init__(self, model, instance_tag, tag_map, collision_behavior=None, collision_field=None, override_loading_method=None, logger=None):
      Severity: Major
      Found in talentmap_api/common/xml_helpers.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

        if data and len(data.strip()) > 0:
        setattr(instance, self.tag_map[key], data)
        else:
        Severity: Major
        Found in talentmap_api/common/xml_helpers.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

          if attempts > max_attempts:
          logger.error(f"SOAP call for {task} exceeded max attempts.")
          break
          else:
          Severity: Major
          Found in talentmap_api/integrations/models.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

            for user in users:
            Notification.objects.create(owner=user,
            tags=['bidding', f'{instance.status}'],
            message=notification_bodies[notification])
             
             
            Severity: Major
            Found in talentmap_api/bidding/models.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

              if self.collision_behavior == 'delete':
              collisions.delete()
              new_instances.append(instance)
              elif self.collision_behavior == 'update':
              # Update our collided instance
              Severity: Major
              Found in talentmap_api/common/xml_helpers.py - About 45 mins to fix

                Function xml_etree_to_dict has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                Open

                def xml_etree_to_dict(tree):
                '''
                Converts an XML etree into a dictionary.
                 
                Args:
                Severity: Minor
                Found in talentmap_api/common/common_helpers.py - About 35 mins to fix

                Avoid too many return statements within this function.
                Open

                return (True, None)
                Severity: Major
                Found in talentmap_api/messaging/views.py - About 30 mins to fix

                  Function destroy has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring.
                  Open

                  def destroy(self, request, *args, **kwargs):
                  '''
                  Closes or deletes specified bid
                   
                  This endpoint will delete bids which are still in a draft status, but close any other status
                  Severity: Minor
                  Found in talentmap_api/bidding/views/bidlist.py - About 25 mins to fix

                  Function update_relationships has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring.
                  Open

                  def update_relationships(self):
                  # Search for country based on location prefix
                  country = Country.objects.filter(location_prefix=self.code[:2])
                  if country.count() != 1:
                  # Try matching by name
                  Severity: Minor
                  Found in talentmap_api/organization/models.py - About 25 mins to fix

                  Do not use bare 'except'
                  Open

                  except:
                  Severity: Minor
                  Found in talentmap_api/common/permissions.py by pep8

                  Do not use bare 'except'
                  Open

                  except:
                  Severity: Minor
                  Found in talentmap_api/common/permissions.py by pep8

                  Do not use bare 'except'
                  Open

                  except:
                  Severity: Minor
                  Found in talentmap_api/wsgi.py by pep8

                  Over-indented
                  Open

                  """
                  Severity: Minor
                  Found in talentmap_api/feedback/models.py by pep8

                  Do not use bare 'except'
                  Open

                  except:

                  Do not use bare 'except'
                  Open

                  except:
                  Severity: Minor
                  Found in talentmap_api/common/common_helpers.py by pep8

                  Do not use bare 'except'
                  Open

                  except:
                  Severity: Minor
                  Found in talentmap_api/common/common_helpers.py by pep8
                  Severity
                  Category
                  Status
                  Source
                  Language