MetaPhase-Consulting/State-TalentMAP-API

View on GitHub

Showing 882 of 882 total issues

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

                            with myzip.open(f) as myfile:
                                lines = myfile.read()
                else:
    Severity: Major
    Found in talentmap_api/log_viewer/services.py - About 45 mins to fix

      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 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 sorting_values has a Cognitive Complexity of 10 (exceeds 7 allowed). Consider refactoring.
        Open

        def sorting_values(sort, use_post=False):
            if sort is not None:
                results = []
                for s in sort.split(','):
                    direction = 'asc'
        Severity: Minor
        Found in talentmap_api/fsbid/services/common.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 matchText:
                                refRemarkText = refRemarkText.replace(matchText['riinsertiontext'], insertion['airiinsertiontext'])
                            else:
                                continue
        
        
        Severity: Major
        Found in talentmap_api/fsbid/services/common.py - About 45 mins to fix

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

          def csv_fsbid_template_to_tm(data, mapping):
              '''
              Get row for csv ready for write.
              You'll still need to set up the csv headers outside this function.
              The return from this mapping can be written to csv with
          Severity: Minor
          Found in talentmap_api/fsbid/services/common.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

                                  for ail in existing_ails:
                                      ai_seq_num = query["aiseqnum"]
                                      delete_agenda_item_leg(ail, ai_seq_num, jwt_token)
                              for leg in legs:
          Severity: Major
          Found in talentmap_api/fsbid/services/agenda.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

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

                  Avoid deeply nested control flow statements.
                  Open

                                          if not pydash.get(agenda_item_leg, "[0].ail_seq_num"):
                                              logger.error("Error creating AIL")
                                  
                                  # Unpack existing AIR/AIRI
                                  existing_remarks = refData.get("remarks")
                  Severity: Major
                  Found in talentmap_api/fsbid/services/agenda.py - About 45 mins to fix

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

                    def get_available_bidders_csv(request):
                        '''
                        Returns csv format of all users in Available Bidders list
                        '''
                        data = client_services.get_available_bidders(request.META['HTTP_JWT'], False, request.query_params, f"{request.scheme}://{request.get_host()}")
                    Severity: Minor
                    Found in talentmap_api/bureau/services/available_bidders.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

                    Consider simplifying this complex logical expression.
                    Open

                                if (status_code or tod_code or tod_combined_months_num or 
                                    tod_combined_other_text or asg_seq_num or asg_revision_num):
                                    if existing_ai_seq_num:
                                        if ((status_code != existing_status_code) or
                                            (tod_code != existing_tod_code) or
                    Severity: Major
                    Found in talentmap_api/fsbid/services/agenda.py - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                                          if ((status_code != existing_status_code) or
                                              (tod_code != existing_tod_code) or
                                              (tod_combined_months_num != existing_tod_combined_months_num) or
                                              (tod_combined_other_text != existing_tod_combined_other_text) or
                                              (asg_seq_num != existing_asg_seq_num) or
                      Severity: Major
                      Found in talentmap_api/fsbid/services/agenda.py - About 40 mins to fix

                        Function get_fsbid_results has 6 arguments (exceeds 5 allowed). Consider refactoring.
                        Open

                        def get_fsbid_results(uri, jwt_token, mapping_function, email=None, use_cache=False, api_root=API_ROOT):
                        Severity: Minor
                        Found in talentmap_api/fsbid/services/common.py - About 35 mins to fix

                          Function get_results has 6 arguments (exceeds 5 allowed). Consider refactoring.
                          Open

                          def get_results(uri, query, query_mapping_function, jwt_token, mapping_function, api_root=API_ROOT):
                          Severity: Minor
                          Found in talentmap_api/fsbid/services/common.py - About 35 mins to fix

                            Function send_post_back_office has 6 arguments (exceeds 5 allowed). Consider refactoring.
                            Open

                            def send_post_back_office(proc_name, package_name, request_body, request_mapping_function, response_mapping_function, jwt_token):
                            Severity: Minor
                            Found in talentmap_api/fsbid/services/common.py - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language