MetaPhase-Consulting/State-TalentMAP-API

View on GitHub

Showing 99 of 885 total issues

Function get_bids_csv has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def get_bids_csv(data, filename, jwt_token):
    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 1 hr to fix

    Function get_ap_and_pv_csv has 32 lines of code (exceeds 25 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 1 hr to fix

      Function perform_create has a Cognitive Complexity of 13 (exceeds 7 allowed). Consider refactoring.
      Open

          def perform_create(self, serializer):
              if isinstance(self.request.data, list):
                  data = self.request.data
                  # Empty array
                  if len(data) == 0:
      Severity: Minor
      Found in talentmap_api/available_positions/views/available_position.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_agenda_employees_query has a Cognitive Complexity of 13 (exceeds 7 allowed). Consider refactoring.
      Open

      def convert_agenda_employees_query(query):
          '''
          Convert TalentMAP filters into FSBid filters
          '''
      
      
      Severity: Minor
      Found in talentmap_api/fsbid/services/agenda_employees.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 fsbid_single_agenda_item_to_talentmap_single_agenda_item has 29 lines of code (exceeds 25 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 1 hr to fix

        Function send_get_csv_request has 10 arguments (exceeds 5 allowed). Consider refactoring.
        Open

        def send_get_csv_request(uri, query, query_mapping_function, jwt_token, mapping_function, base_url, host=None, ad_id=None, limit=None, use_post=False):
        Severity: Major
        Found in talentmap_api/fsbid/services/common.py - About 1 hr to fix

          Function send_get_request has 10 arguments (exceeds 5 allowed). Consider refactoring.
          Open

          def send_get_request(uri, query, query_mapping_function, jwt_token, mapping_function, count_function, base_url, host=None, api_root=API_ROOT, use_post=False):
          Severity: Major
          Found in talentmap_api/fsbid/services/common.py - About 1 hr to fix

            Function get_bids_csv has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
            Open

            def get_bids_csv(data, filename, jwt_token):
                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 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_bid_status has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
            Open

            def get_bid_status(statusCode, handshakeCode, assignmentCreateDate, panelMeetingStatus, handshakeAllowed):
                '''
                Map the FSBid status code and handshake code to a TalentMap status
                    statusCode - W → Draft
            
            
            Severity: Minor
            Found in talentmap_api/fsbid/services/bid.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 parse_child_overrides has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
            Open

                def parse_child_overrides(cls, override_fields, override_exclude, name, nested, child_kwargs):
                    '''
                    This method populates a dictionary object with appropriate cascaded child serializers
            
                    Args:
            Severity: Minor
            Found in talentmap_api/common/serializers.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 service_response has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
            Open

            def service_response(data, objStr, mapping=None):
                '''
                Returns data with additional logger and error handling depending on type
                '''
                if data is None:
            Severity: Minor
            Found in talentmap_api/common/common_helpers.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_fsbid_results has a Cognitive Complexity of 11 (exceeds 7 allowed). Consider refactoring.
            Open

            def get_fsbid_results(uri, jwt_token, mapping_function, email=None, use_cache=False, api_root=API_ROOT):
                url = f"{api_root}/{uri}"
                # TODO - fix SSL issue with use_cache
                # method = session if use_cache else requests
                method = requests
            Severity: Minor
            Found in talentmap_api/fsbid/services/common.py - About 55 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

            Function validate_filters_exist has a Cognitive Complexity of 11 (exceeds 7 allowed). Consider refactoring.
            Open

            def validate_filters_exist(filter_list, filter_class):
                for filter in filter_list.keys():
                    '''
                    The filter class (a subclass of FilterSet) passed into this function has knowledge of all
                    implicit and declared filters. Declared filters are those explicity instantiated (typically
            Severity: Minor
            Found in talentmap_api/common/common_helpers.py - About 55 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

            Function send_count_request has 8 arguments (exceeds 5 allowed). Consider refactoring.
            Open

            def send_count_request(uri, query, query_mapping_function, jwt_token, host=None, api_root=API_ROOT, use_post=False, is_template=False):
            Severity: Major
            Found in talentmap_api/fsbid/services/common.py - About 50 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

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

                    def get(self, request, pk, cp_id):
                        """
                        Return position information for all of bidders' bids including their ranking information for those positions
                        """
                        user_bids = bidservices.user_bids(pk, request.META['HTTP_JWT'])
                Severity: Minor
                Found in talentmap_api/available_positions/views/available_position.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

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

                def bureau_exceptions_res_mapping(data):
                    if data is None or (data['O_RETURN_CODE'] and data['O_RETURN_CODE'] is not 0):
                        logger.error('FSBid call for Bureau Exceptions failed.')
                        return None
                        
                Severity: Minor
                Found in talentmap_api/fsbid/services/bureau_exceptions.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

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

                    def modClassifications(self, results):
                        duplicate_results = list(results)
                        unique_codes = set(map(lambda x: x['code'], duplicate_results))
                
                        nested_results, seasons, classification_text, glossary_term = [], [], '', ''
                Severity: Minor
                Found in talentmap_api/fsbid/views/reference.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 not pydash.get(agenda_item_remark, "[0].rmrk_seq_num"):
                                            logger.error("Error creating AIR")
                                        elif remark_inserts:
                                            for insert in remark_inserts:
                                                agenda_item_remark_insert = create_agenda_item_remark_insert(insert, query, jwt_token)
                Severity: Major
                Found in talentmap_api/fsbid/services/agenda.py - About 45 mins to fix

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

                  def get_individual(uri, query, query_mapping_function, jwt_token, mapping_function, api_root=API_ROOT, use_post=False):
                  Severity: Major
                  Found in talentmap_api/fsbid/services/common.py - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language