MetaPhase-Consulting/State-TalentMAP-API

View on GitHub

Showing 99 of 884 total issues

Function create_models_from_csv has a Cognitive Complexity of 27 (exceeds 7 allowed). Consider refactoring.
Open

    def create_models_from_csv(self, csv_filepath):
        '''
        Loads data from an CSV file into a model, using a defined mapping of fields
        to CSV column titles.

Severity: Minor
Found in talentmap_api/common/xml_helpers.py - About 3 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

File employee.py has 307 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
from functools import partial
from urllib.parse import urlencode, quote

from django.conf import settings
Severity: Minor
Found in talentmap_api/fsbid/services/employee.py - About 3 hrs to fix

    File admin_projected_vacancies.py has 303 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import logging
    import requests  # pylint: disable=unused-import
    import pydash
    from urllib.parse import urlencode, quote
    from talentmap_api.fsbid.services import common as services
    Severity: Minor
    Found in talentmap_api/fsbid/services/admin_projected_vacancies.py - About 3 hrs to fix

      Function fsbid_clients_to_talentmap_clients has a Cognitive Complexity of 25 (exceeds 7 allowed). Consider refactoring.
      Open

      def fsbid_clients_to_talentmap_clients(data):
          employee = data.get('employee', None)
          current_assignment = None
          assignments = None
          position = None
      Severity: Minor
      Found in talentmap_api/fsbid/services/client.py - About 3 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 fsbid_available_bidder_to_talentmap has a Cognitive Complexity of 25 (exceeds 7 allowed). Consider refactoring.
      Open

      def fsbid_available_bidder_to_talentmap(data):
          employee = data.get('employee', None)
          current_assignment = None
          assignments = None
          position = None
      Severity: Minor
      Found in talentmap_api/fsbid/services/client.py - About 3 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

      File bidding_tool.py has 297 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import logging
      from talentmap_api.fsbid.services import common as services
      from talentmap_api.common.common_helpers import service_response
      
      
      
      Severity: Minor
      Found in talentmap_api/fsbid/services/bidding_tool.py - About 3 hrs to fix

        Function formatCSV has a Cognitive Complexity of 24 (exceeds 7 allowed). Consider refactoring.
        Open

        def formatCSV(data, fieldsInfo):
            fields_formatted = {}
        
            for f in fieldsInfo:
                if f == "skills":
        Severity: Minor
        Found in talentmap_api/common/common_helpers.py - About 3 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

        File projected_vacancies.py has 286 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import logging
        from functools import partial
        
        import requests  # pylint: disable=unused-import
        import pydash
        Severity: Minor
        Found in talentmap_api/fsbid/services/projected_vacancies.py - About 2 hrs to fix

          Function fsbid_single_agenda_item_to_talentmap_single_agenda_item has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring.
          Open

          def fsbid_single_agenda_item_to_talentmap_single_agenda_item(data, ref_skills={}):
              agendaStatusAbbrev = {
                  "Approved": "APR",
                  "Deferred - Proposed Position": "XXX",
                  "Disapproved": "DIS",
          Severity: Minor
          Found in talentmap_api/fsbid/services/agenda.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 archive_favorites has a Cognitive Complexity of 21 (exceeds 7 allowed). Consider refactoring.
          Open

          def archive_favorites(ids, request, isPV=False, favoritesLimit=FAVORITES_LIMIT):
              fav_length = len(ids)
              if fav_length >= favoritesLimit or fav_length == round(favoritesLimit / 2):
                  # Pos nums is string to pass correctly to services url
                  pos_nums = ','.join(ids)
          Severity: Minor
          Found in talentmap_api/fsbid/services/common.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

          File panel.py has 274 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import logging
          from urllib.parse import urlencode, quote
          from functools import partial
          from copy import deepcopy
          import csv
          Severity: Minor
          Found in talentmap_api/fsbid/services/panel.py - About 2 hrs to fix

            File reference.py has 273 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import logging
            from urllib.parse import urlencode, quote
            from functools import partial
            import pydash
            
            
            Severity: Minor
            Found in talentmap_api/fsbid/services/reference.py - About 2 hrs to fix

              Function get_agendas_by_panel has a Cognitive Complexity of 20 (exceeds 7 allowed). Consider refactoring.
              Open

              def get_agendas_by_panel(pk, jwt_token):
                  '''
                  Get agendas for panel meeting
                  '''
                  skillUrl = f"{API_ROOT}/v1/references/skills"
              Severity: Minor
              Found in talentmap_api/fsbid/services/agenda.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 prefetch_model has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
              Open

                  def prefetch_model(cls, model, queryset, prefix="", parent_method=None, visited=None):
                      '''
                      This method sets up prefetch and selected related statements when applicable
                      for foreign key relationships.
              
              
              Severity: Minor
              Found in talentmap_api/common/serializers.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 get_single_agenda_item has a Cognitive Complexity of 19 (exceeds 7 allowed). Consider refactoring.
              Open

              def get_single_agenda_item(jwt_token=None, pk=None):
                  '''
                  Get single agenda item
                  '''
              
              
              Severity: Minor
              Found in talentmap_api/fsbid/services/agenda.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 __init__ has a Cognitive Complexity of 18 (exceeds 7 allowed). Consider refactoring.
              Open

                  def __init__(self, *args, **kwargs):
                      override_fields = kwargs.pop("override_fields", [])
                      override_exclude = kwargs.pop("override_exclude", [])
              
                      # Initializer our parent serializer
              Severity: Minor
              Found in talentmap_api/common/serializers.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 filter_queryset has a Cognitive Complexity of 17 (exceeds 7 allowed). Consider refactoring.
              Open

                  def filter_queryset(self, request, queryset, view):
                      ordering = self.get_ordering(request, queryset, view)
                      insensitive_ordering = getattr(view, 'ordering_case_insensitive_fields', ())
              
                      for k in insensitive_ordering:
              Severity: Minor
              Found in talentmap_api/common/filters.py - About 1 hr 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 get_available_bidders_csv has a Cognitive Complexity of 14 (exceeds 7 allowed). Consider refactoring.
              Open

              def get_available_bidders_csv(request):
                  '''
                  Returns csv format of Available Bidders list
                  '''
                  data = client_services.get_available_bidders(request.META['HTTP_JWT'], True, request.query_params, f"{request.scheme}://{request.get_host()}")
              Severity: Minor
              Found in talentmap_api/cdo/services/available_bidders.py - About 1 hr 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 get_queryset has a Cognitive Complexity of 14 (exceeds 7 allowed). Consider refactoring.
              Open

                  def get_queryset(self):
                      # Oracle and Django don't play nice with JSON. This makes filtering by an array of tags difficult.
                      # We comma separate the tags provided in the ?tags query parameter (ex: ?tags=a,b,c).
                      tags = list(self.request.GET.get('tags', '').split(','))
                      # filter out an empty strings
              Severity: Minor
              Found in talentmap_api/messaging/views.py - About 1 hr 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 convert_to_fsbid_ql has a Cognitive Complexity of 14 (exceeds 7 allowed). Consider refactoring.
              Open

              def convert_to_fsbid_ql(filters):
                  formattedFilters = []
              
                  for fil in filters:
                      if pydash.get(fil, 'col') and pydash.get(fil, 'val'):
              Severity: Minor
              Found in talentmap_api/fsbid/services/common.py - About 1 hr 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