MetaPhase-Consulting/State-TalentMAP-API

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

Summary

Maintainability
A
3 hrs
Test Coverage
D
65%

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

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 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.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.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 Bid.Status.in_panel
          Severity: Major
          Found in talentmap_api/fsbid/services/bid.py - About 30 mins to fix

            Expected 2 blank lines, found 1
            Open

            def get_bids(query, jwt_token, pk):
            Severity: Minor
            Found in talentmap_api/fsbid/services/bid.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_user_bids_csv(employee_id, jwt_token, position_id=None, query={}):
            Severity: Minor
            Found in talentmap_api/fsbid/services/bid.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

            At least two spaces before inline comment
            Open

                        "id": cpId, # even if we can't return positionInfo, we can at least return id
            Severity: Minor
            Found in talentmap_api/fsbid/services/bid.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 user_bids(employee_id, jwt_token, position_id=None, query={}):
            Severity: Minor
            Found in talentmap_api/fsbid/services/bid.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

            Continuation line unaligned for hanging indent
            Open

                                                 and not pydash.find(hasAcceptedHandshakeIds, lambda y: y['cp_id'] == pydash.get(x, 'position_info.id'))
            Severity: Minor
            Found in talentmap_api/fsbid/services/bid.py by pep8

            Continuation lines indentation.

            Continuation lines should align wrapped elements either vertically
            using Python's implicit line joining inside parentheses, brackets
            and braces, or using a hanging indent.
            
            When using a hanging indent these considerations should be applied:
            - there should be no arguments on the first line, and
            - further indentation should be used to clearly distinguish itself
              as a continuation line.
            
            Okay: a = (\n)
            E123: a = (\n    )
            
            Okay: a = (\n    42)
            E121: a = (\n   42)
            E122: a = (\n42)
            E123: a = (\n    42\n    )
            E124: a = (24,\n     42\n)
            E125: if (\n    b):\n    pass
            E126: a = (\n        42)
            E127: a = (24,\n      42)
            E128: a = (24,\n    42)
            E129: if (a or\n    b):\n    pass
            E131: a = (\n    42\n 24)

            Continuation line unaligned for hanging indent
            Open

                                                 else False,
            Severity: Minor
            Found in talentmap_api/fsbid/services/bid.py by pep8

            Continuation lines indentation.

            Continuation lines should align wrapped elements either vertically
            using Python's implicit line joining inside parentheses, brackets
            and braces, or using a hanging indent.
            
            When using a hanging indent these considerations should be applied:
            - there should be no arguments on the first line, and
            - further indentation should be used to clearly distinguish itself
              as a continuation line.
            
            Okay: a = (\n)
            E123: a = (\n    )
            
            Okay: a = (\n    42)
            E121: a = (\n   42)
            E122: a = (\n42)
            E123: a = (\n    42\n    )
            E124: a = (24,\n     42\n)
            E125: if (\n    b):\n    pass
            E126: a = (\n        42)
            E127: a = (24,\n      42)
            E128: a = (24,\n    42)
            E129: if (a or\n    b):\n    pass
            E131: a = (\n    42\n 24)

            There are no issues that match your filters.

            Category
            Status