uktrade/aioftps3

View on GitHub

Showing 8 of 22 total issues

Function is_good_sequence has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def is_good_sequence(command):
        is_ssl = ssl_sock is not None

        is_good = \
            (command == 'AUTH' and not is_ssl and not is_authenticated and not user) or \
Severity: Minor
Found in aioftps3/server.py - About 2 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 read_without_reader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def read_without_reader():
        try:
            num_bytes = get_sock().recv_into(buf_memoryview, max_bytes)

        except (SSLWantReadError, BlockingIOError):
Severity: Minor
Found in aioftps3/server_socket.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 _parse_list_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _parse_list_response(body):
        namespace = '{http://s3.amazonaws.com/doc/2006-03-01/}'
        root = ET.fromstring(body)
        next_token = ''
        keys = []
Severity: Minor
Found in aioftps3/server_s3.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 write_with_writer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def write_with_writer():
        try:
            num_bytes = get_sock().send(buf_memoryview[:max_bytes])

        except (SSLWantWriteError, BlockingIOError):
Severity: Minor
Found in aioftps3/server_socket.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 write_without_writer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def write_without_writer():
        try:
            num_bytes = get_sock().send(buf_memoryview[:max_bytes])

        except (SSLWantWriteError, BlockingIOError):
Severity: Minor
Found in aioftps3/server_socket.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 read_with_reader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def read_with_reader():
        try:
            num_bytes = get_sock().recv_into(buf_memoryview, max_bytes)

        except (SSLWantReadError, BlockingIOError):
Severity: Minor
Found in aioftps3/server_socket.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 unwrap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def unwrap():
        try:
            sock = ssl_sock.unwrap()
            if not done.cancelled():
                done.set_result(sock)
Severity: Minor
Found in aioftps3/server_socket.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 handshake has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def handshake():
        try:
            ssl_sock.do_handshake()
            if not done.cancelled():
                done.set_result(None)
Severity: Minor
Found in aioftps3/server_socket.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