Showing 224 of 224 total issues
Function upsert_keys
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def upsert_keys(
self,
keys: Iterable[str],
candidate_classes: Union[Candidate, Iterable[Candidate], None] = None,
) -> None:
- 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 create_task
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_task(
Function _get_axis_ngrams
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_axis_ngrams(
Function get_neighbor_cell_ngrams
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_neighbor_cell_ngrams(
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _get_direction_ngrams
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_direction_ngrams(
Function apply
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def apply( # type: ignore
Function get_row_ngrams
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_row_ngrams(
Avoid deeply nested control flow statements. Open
if [span_sentences[1:] == span_sentences[:-1]]:
yield "SAME_SENTENCE", DEF_VALUE
else:
Avoid deeply nested control flow statements. Open
for span, sent, s_idx, i in zip(
spans, sents, s_idxs, range(len(spans))
):
for f in _get_ddlib_feats(span, sent, s_idx):
Function get_right_ngrams
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_right_ngrams(
Function get_neighbor_sentence_ngrams
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_neighbor_sentence_ngrams(
Avoid deeply nested control flow statements. Open
for ngram in tokens_to_ngrams(
getattr(sentence, attrib), n_min=n_min, n_max=n_max, lower=lower
):
yield ngram
else:
Function get_cell_ngrams
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_cell_ngrams(
mention: Union[Candidate, Mention, TemporarySpanMention],
attrib: str = "words",
n_min: int = 1,
n_max: int = 1,
- 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
Avoid deeply nested control flow statements. Open
for feature, value in _strlib_unary_features(span):
unary_strlib_feats[span.stable_id].add((feature, value))
Function get_horz_ngrams
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_horz_ngrams(
Function _assign_alignment_features
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _assign_alignment_features(sentences_by_key: defaultdict, align_type: str) -> None:
for key, sentences in sentences_by_key.items():
if len(sentences) == 1:
continue
context_lemmas: Set[str] = set()
- 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_head_ngrams
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_head_ngrams(
Avoid deeply nested control flow statements. Open
for ngram in tokens_to_ngrams(
getattr(sentence, attrib), n_min=n_min, n_max=n_max, lower=lower
):
yield ngram
Function __getitem__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __getitem__(self, key: slice) -> "TemporarySpanMention":
"""Slice operation returns a new candidate sliced according to **char index**.
Note that the slicing is w.r.t. the candidate range (not the abs.
sentence char indexing).
- 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"