MetaPhase-Consulting/State-TalentMAP-API

View on GitHub
talentmap_api/fsbid/services/client.py

Summary

Maintainability
D
2 days
Test Coverage
F
14%

File client.py has 558 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import csv
import logging
from copy import deepcopy
from datetime import datetime
from urllib.parse import urlencode, quote
Severity: Major
Found in talentmap_api/fsbid/services/client.py - About 1 day to fix

    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

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

    Do not compare types, use 'isinstance()'
    Open

            if type(assignments) is type([]) and list(assignments):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Object type comparisons should always use isinstance().

    Do not compare types directly.
    
    Okay: if isinstance(obj, int):
    E721: if type(obj) is type(1):
    
    When checking if an object is a string, keep in mind that it might
    be a unicode string too! In Python 2.3, str and unicode have a
    common base class, basestring, so you can do:
    
    Okay: if isinstance(obj, basestring):
    Okay: if type(a1) is type(b1):

    Do not compare types, use 'isinstance()'
    Open

        if type(assignments) is type(dict()):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Object type comparisons should always use isinstance().

    Do not compare types directly.
    
    Okay: if isinstance(obj, int):
    E721: if type(obj) is type(1):
    
    When checking if an object is a string, keep in mind that it might
    be a unicode string too! In Python 2.3, str and unicode have a
    common base class, basestring, so you can do:
    
    Okay: if isinstance(obj, basestring):
    Okay: if type(a1) is type(b1):

    At least two spaces before inline comment
    Open

                            "bureau_code": pydash.get(pos, 'pos_bureau_short_desc'), # only comes through for available bidders
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Separate inline comments by at least two spaces.

    An inline comment is a comment on the same line as a statement.
    Inline comments should be separated by at least two spaces from the
    statement. They should start with a # and a single space.
    
    Each line of a block comment starts with a # and a single space
    (unless it is indented text inside the comment).
    
    Okay: x = x + 1  # Increment x
    Okay: x = x + 1    # Increment x
    Okay: # Block comment
    E261: x = x + 1 # Increment x
    E262: x = x + 1  #Increment x
    E262: x = x + 1  #  Increment x
    E265: #Block comment
    E266: ### Block comment

    At least two spaces before inline comment
    Open

            False, # No count function
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Separate inline comments by at least two spaces.

    An inline comment is a comment on the same line as a statement.
    Inline comments should be separated by at least two spaces from the
    statement. They should start with a # and a single space.
    
    Each line of a block comment starts with a # and a single space
    (unless it is indented text inside the comment).
    
    Okay: x = x + 1  # Increment x
    Okay: x = x + 1    # Increment x
    Okay: # Block comment
    E261: x = x + 1 # Increment x
    E262: x = x + 1  #Increment x
    E262: x = x + 1  #  Increment x
    E265: #Block comment
    E266: ### Block comment

    Missing whitespace after ':'
    Open

            "results": list({v['perdet_seq_number']:v for v in response.get('results')}.values()),
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Each comma, semicolon or colon should be followed by whitespace.

    Okay: [a, b]
    Okay: (3,)
    Okay: a[1:4]
    Okay: a[:4]
    Okay: a[1:]
    Okay: a[1:4:2]
    E231: ['a','b']
    E231: foo(bar,baz)
    E231: [{'a':'b'}]

    Do not use bare 'except'
    Open

        except:
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    When catching exceptions, mention specific exceptions when possible.

    Okay: except Exception:
    Okay: except BaseException:
    E722: except:

    Do not use bare 'except'
    Open

        except:
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    When catching exceptions, mention specific exceptions when possible.

    Okay: except Exception:
    Okay: except BaseException:
    E722: except:

    Expected 2 blank lines, found 1
    Open

    def fsbid_no_successful_panel_to_tmap(panel):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Separate top-level function and class definitions with two blank lines.

    Method definitions inside a class are separated by a single blank
    line.
    
    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).
    
    Use blank lines in functions, sparingly, to indicate logical
    sections.
    
    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1
    
    E301: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

    Do not compare types, use 'isinstance()'
    Open

        if type(assignmentsCopy) is type([]):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Object type comparisons should always use isinstance().

    Do not compare types directly.
    
    Okay: if isinstance(obj, int):
    E721: if type(obj) is type(1):
    
    When checking if an object is a string, keep in mind that it might
    be a unicode string too! In Python 2.3, str and unicode have a
    common base class, basestring, so you can do:
    
    Okay: if isinstance(obj, basestring):
    Okay: if type(a1) is type(b1):

    Do not use bare 'except'
    Open

        except:
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    When catching exceptions, mention specific exceptions when possible.

    Okay: except Exception:
    Okay: except BaseException:
    E722: except:

    Expected 2 blank lines, found 1
    Open

    def fsbid_available_bidder_to_talentmap(data):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Separate top-level function and class definitions with two blank lines.

    Method definitions inside a class are separated by a single blank
    line.
    
    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).
    
    Use blank lines in functions, sparingly, to indicate logical
    sections.
    
    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1
    
    E301: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

    Do not compare types, use 'isinstance()'
    Open

            if type(assignments) is type([]) and list(assignments):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Object type comparisons should always use isinstance().

    Do not compare types directly.
    
    Okay: if isinstance(obj, int):
    E721: if type(obj) is type(1):
    
    When checking if an object is a string, keep in mind that it might
    be a unicode string too! In Python 2.3, str and unicode have a
    common base class, basestring, so you can do:
    
    Okay: if isinstance(obj, basestring):
    Okay: if type(a1) is type(b1):

    Do not use bare 'except'
    Open

        except:
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    When catching exceptions, mention specific exceptions when possible.

    Okay: except Exception:
    Okay: except BaseException:
    E722: except:

    Do not compare types, use 'isinstance()'
    Open

            if type(assignments) is type(dict()):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Object type comparisons should always use isinstance().

    Do not compare types directly.
    
    Okay: if isinstance(obj, int):
    E721: if type(obj) is type(1):
    
    When checking if an object is a string, keep in mind that it might
    be a unicode string too! In Python 2.3, str and unicode have a
    common base class, basestring, so you can do:
    
    Okay: if isinstance(obj, basestring):
    Okay: if type(a1) is type(b1):

    Do not compare types, use 'isinstance()'
    Open

            if type(assignments) is type(dict()):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Object type comparisons should always use isinstance().

    Do not compare types directly.
    
    Okay: if isinstance(obj, int):
    E721: if type(obj) is type(1):
    
    When checking if an object is a string, keep in mind that it might
    be a unicode string too! In Python 2.3, str and unicode have a
    common base class, basestring, so you can do:
    
    Okay: if isinstance(obj, basestring):
    Okay: if type(a1) is type(b1):

    At least two spaces before inline comment
    Open

            desc = pydash.get(data, f'per_skill{index}_code_desc', None) # Not coming through with /Persons
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Separate inline comments by at least two spaces.

    An inline comment is a comment on the same line as a statement.
    Inline comments should be separated by at least two spaces from the
    statement. They should start with a # and a single space.
    
    Each line of a block comment starts with a # and a single space
    (unless it is indented text inside the comment).
    
    Okay: x = x + 1  # Increment x
    Okay: x = x + 1    # Increment x
    Okay: # Block comment
    E261: x = x + 1 # Increment x
    E262: x = x + 1  #Increment x
    E262: x = x + 1  #  Increment x
    E265: #Block comment
    E266: ### Block comment

    Expected 2 blank lines, found 1
    Open

    def fsbid_no_bids_to_tmap(bids):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Separate top-level function and class definitions with two blank lines.

    Method definitions inside a class are separated by a single blank
    line.
    
    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).
    
    Use blank lines in functions, sparingly, to indicate logical
    sections.
    
    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1
    
    E301: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

    Expected 2 blank lines, found 1
    Open

    def get_available_bidders(jwt_token, isCDO, query, host=None):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Separate top-level function and class definitions with two blank lines.

    Method definitions inside a class are separated by a single blank
    line.
    
    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).
    
    Use blank lines in functions, sparingly, to indicate logical
    sections.
    
    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1
    
    E301: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

    Expected 2 blank lines, found 1
    Open

    def convert_available_bidder_query(query):
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    Separate top-level function and class definitions with two blank lines.

    Method definitions inside a class are separated by a single blank
    line.
    
    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).
    
    Use blank lines in functions, sparingly, to indicate logical
    sections.
    
    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1
    
    E301: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

    Do not use bare 'except'
    Open

        except:
    Severity: Minor
    Found in talentmap_api/fsbid/services/client.py by pep8

    When catching exceptions, mention specific exceptions when possible.

    Okay: except Exception:
    Okay: except BaseException:
    E722: except:

    There are no issues that match your filters.

    Category
    Status