Showing 46 of 46 total issues
Avoid too many return
statements within this function. Open
return [
Avoid too many return
statements within this function. Open
return
Function _process_transaction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _process_transaction(
self,
grouped_postings: _GroupedPostings,
) -> None:
prorated_ownership_builder = _ProratedOwnershipBuilder()
- 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 _dfs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _dfs(self, node: _Node, matches: dict[_Node, _Node], visited: set[_Node]) -> bool:
visited.add(node)
for sibling in self._edges[node]:
if sibling not in matches:
matches[sibling] = node
- 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 handle_transaction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle_transaction(self, entry: Transaction) -> Iterator[Directive]:
if transaction := self._account_splitter.process_transaction(entry, self._receivable_account):
for posting in transaction.postings:
if self._is_receivable_account(posting.account):
yield from self._open_account_if_not_opened(posting.account, transaction)
- 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 realize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def realize(self, root: realization.RealAccount, accounts: set[str]) -> None:
for party, postings in self._postings_by_party.items():
for posting in postings:
if posting.account in accounts:
real_account = realization.get_or_create(root, f'{posting.account}:{party}')
- 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"