File repository.py
has 910 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import os
import sys
from typing import Optional
from unittest.mock import patch
Function test_remote_rpc_exception_transport
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def test_remote_rpc_exception_transport(remote_repository):
with remote_repository:
s1 = "test string"
try:
- Read upRead up
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 reopen
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def reopen(repository, exclusive: Optional[bool] = True, create=False):
if isinstance(repository, Repository):
if repository.io is not None or repository.lock is not None:
raise RuntimeError("Repo must be closed before a reopen. Cannot support nested repository contexts.")
return Repository(repository.path, exclusive=exclusive, create=create)
- Read upRead up
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 test_moved_deletes_are_tracked
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def test_moved_deletes_are_tracked(repository):
with repository:
repository.put(H(1), fchunk(b"1"))
repository.put(H(2), fchunk(b"2"))
repository.commit(compact=False)
- Read upRead up
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"