MetaPhase-Consulting/State-TalentMAP-API

View on GitHub

Showing 882 of 882 total issues

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

        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 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 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 send_count_request has a Cognitive Complexity of 9 (exceeds 7 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):
            '''
            Gets the total number of items for a filterset
            '''
            args = {}
        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_log has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
        Open

        def get_log(log_name, size=1000):
            lines = ""
            file_name = f"{log_dir}{log_name}"
            if os.path.exists(f"{file_name}"):
                try:
        Severity: Minor
        Found in talentmap_api/log_viewer/services.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

        Avoid too many return statements within this function.
        Open

                    return Bid.Status.handshake_needs_registered
        Severity: Major
        Found in talentmap_api/fsbid/services/bid.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return parser.parse(date + '.000Z').astimezone(datetime.timezone.utc) - datetime.timedelta(hours=utc_offset)
          Severity: Major
          Found in talentmap_api/common/common_helpers.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return "Invalid date"
            Severity: Major
            Found in talentmap_api/common/common_helpers.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return Bid.Status.submitted
              Severity: Major
              Found in talentmap_api/fsbid/services/bid.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return Bid.Status.in_panel
                Severity: Major
                Found in talentmap_api/fsbid/services/bid.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return Response(status=status.HTTP_204_NO_CONTENT)
                  Severity: Major
                  Found in talentmap_api/available_positions/views/available_position.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return Bid.Status.handshake_accepted
                    Severity: Major
                    Found in talentmap_api/fsbid/services/bid.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return Bid.Status.draft
                      Severity: Major
                      Found in talentmap_api/fsbid/services/bid.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return newly_created_ai_seq_num or existing_ai_seq_num
                        Severity: Major
                        Found in talentmap_api/fsbid/services/agenda.py - About 30 mins to fix

                          Function get_aih_csv has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring.
                          Open

                          def get_aih_csv(data, filename):
                              filename = re.sub(r'(\_)\1+', r'\1', filename.replace(',', '_').replace(' ', '_').replace("'", '_'))
                              response = HttpResponse(content_type='text/csv')
                              response['Content-Disposition'] = f"attachment; filename={filename}_{datetime.now().strftime('%Y_%m_%d_%H%M%S')}.csv"
                          
                          
                          Severity: Minor
                          Found in talentmap_api/fsbid/services/common.py - About 25 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_languages_to_tmap has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring.
                          Open

                          def fsbid_languages_to_tmap(languages):
                              tmap_languages = []
                              empty_score = '--'
                              for x in languages:
                                  if not x.get('empl_language', None) or not str(x.get('empl_language')).strip():
                          Severity: Minor
                          Found in talentmap_api/fsbid/services/client.py - About 25 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