MetaPhase-Consulting/State-TalentMAP-API

View on GitHub

Showing 99 of 885 total issues

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

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

      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

        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

        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

                                  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

            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_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_request has 6 arguments (exceeds 5 allowed). Consider refactoring.
                  Open

                  def send_post_request(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_put_request has 6 arguments (exceeds 5 allowed). Consider refactoring.
                    Open

                    def send_put_request(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 get_results_with_post has 6 arguments (exceeds 5 allowed). Consider refactoring.
                      Open

                      def get_results_with_post(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 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 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

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

                            def get_results(uri, query, query_mapping_function, jwt_token, mapping_function, api_root=API_ROOT):
                                queryClone = query or {}
                                if query_mapping_function:
                                    url = f"{api_root}/{uri}?{query_mapping_function(queryClone)}"
                                else:
                            Severity: Minor
                            Found in talentmap_api/fsbid/services/common.py - About 35 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_agenda_employees_csv has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                            Open

                            def get_agenda_employees_csv(query, jwt_token, rl_cd, host=None):
                                from talentmap_api.fsbid.services.common import send_get_csv_request, mapBool
                                from talentmap_api.fsbid.services.cdo import cdo
                                ad_id = jwt.decode(jwt_token, verify=False).get('unique_name')
                                try:
                            Severity: Minor
                            Found in talentmap_api/fsbid/services/agenda_employees.py - About 35 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 fsbid_legs_to_talentmap_legs has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                            Open

                            def fsbid_legs_to_talentmap_legs(data):
                                tod_code = pydash.get(data, "ailtodcode")
                                tod_short_desc = pydash.get(data, "todshortdesc")
                                tod_long_desc = pydash.get(data, "toddesctext")
                                # only custom/other TOD will have other_text
                            Severity: Minor
                            Found in talentmap_api/fsbid/services/agenda.py - About 35 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_get_csv_request has a Cognitive Complexity of 9 (exceeds 7 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):
                                '''
                                Gets items from FSBid
                                '''
                                formattedQuery = query
                            Severity: Minor
                            Found in talentmap_api/fsbid/services/common.py - About 35 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

                            Severity
                            Category
                            Status
                            Source
                            Language