Showing 21 of 21 total issues
Function quotient_graph
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def quotient_graph(
G,
node_attribute,
edge_types=["reference", "cooccurrence"],
self_loops=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"
Further reading
Function get_suffix_and_law_name
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def get_suffix_and_law_name(self, string: str):
"""
Returns: A tuple containing length of
1. the article between numbers and law name (eg. " der ")
- 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
File statutes_parse.py
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import itertools
from collections import Counter
from regex import regex
Function parse_law
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def parse_law(self, law_text: str, match_type: str, current_lawid: str = None):
"""
Parses the law information from a references found by StatutesMatchWithMainArea
Args:
- 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 split_citation_part
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def split_citation_part(string: str):
"""
A string a tokenizes. Tokens are identified as units or values. Pairs are
built to connect the units with their respective values. If the unit cannot
be indentified (and must be inferred later) None is returned.
- 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 load_law_names
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def load_law_names(date, path):
r = requests.get(
f"https://github.com/QuantLaw/gesetze-im-internet/archive/{date}.zip",
stream=True,
)
- 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 split_parts_accidently_joined
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def split_parts_accidently_joined(reference_paths):
"""
Reformats the parsed references to separate accitently joined references.
E.g. the original referehence "§ 123 § 126" will not be split by
split_citation_into_enum_parts because the separation is falsly not indicated by
- 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 execute_filtered_items
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def execute_filtered_items(self, items, filters=None, *args, **kwargs):
if filters:
filtered_items = []
for item in list(items):
for filter_str in filters:
- 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 parse_main
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_main(self, main_text: str) -> list:
"""
Parses a string containing a reference to a specific section within a given law.
E.g. "§ 123 Abs. 4 Satz 5 und 6".
The parsed informtaion is formatted into lists nested in lists nested in lists.
- 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 quotient_graph
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def quotient_graph(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function induced_subgraph
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def induced_subgraph(
Avoid too many return
statements within this function. Open
return suffix_len, 0, "unknown"
Avoid too many return
statements within this function. Open
return suffix_len, ignore_no_suffix_len, "ignore"
Avoid too many return
statements within this function. Open
return None # match_type: ignore or unknown
Avoid too many return
statements within this function. Open
return suffix_len, sgb_suffix_len, "sgb"
Avoid too many return
statements within this function. Open
return lawid
Avoid too many return
statements within this function. Open
return suffix_len, dict_suffix_len, "dict"
Avoid too many return
statements within this function. Open
return current_lawid
Avoid too many return
statements within this function. Open
return 0, 0, "internal"