MetaPhase-Consulting/State-TalentMAP-API

View on GitHub

Showing 885 of 885 total issues

File available_position.py has 336 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import coreapi
import pydash

from django.core.exceptions import PermissionDenied, SuspiciousOperation
Severity: Minor
Found in talentmap_api/available_positions/views/available_position.py - About 4 hrs to fix

    Function get_ap_and_pv_csv has a Cognitive Complexity of 29 (exceeds 7 allowed). Consider refactoring.
    Open

    def get_ap_and_pv_csv(data, filename, ap=False, tandem=False):
        response = HttpResponse(content_type='text/csv')
        response['Content-Disposition'] = f"attachment; filename={filename}_{datetime.now().strftime('%Y_%m_%d_%H%M%S')}.csv"
    
        writer = csv.writer(response, csv.excel)
    Severity: Minor
    Found in talentmap_api/fsbid/services/common.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 modify_panel_meeting_and_dates has a Cognitive Complexity of 28 (exceeds 7 allowed). Consider refactoring.
    Open

    def modify_panel_meeting_and_dates(query, jwt_token):
        '''
        Modify Panel Meeting and Panel Meeting Dates
        '''
        # Inject decoded hru
    Severity: Minor
    Found in talentmap_api/fsbid/services/admin_panel.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 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 305 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

      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

      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

      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 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

          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

          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 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 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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              Severity: Major
              Found in talentmap_api/projected_vacancies/models.py and 1 other location - About 2 hrs to fix
              talentmap_api/projected_tandem/models.py on lines 0..13

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 84.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              Severity: Major
              Found in talentmap_api/projected_tandem/models.py and 1 other location - About 2 hrs to fix
              talentmap_api/projected_vacancies/models.py on lines 0..13

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 84.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              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

              Severity
              Category
              Status
              Source
              Language