Showing 134 of 224 total issues
Function create_task
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_task(
Function apply
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def apply( # type: ignore
Function _get_direction_ngrams
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_direction_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 get_between_ngrams
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_between_ngrams(
c: Candidate,
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
Function clear
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def clear(self) -> None: # type: ignore
"""Delete Mentions of each class in the extractor from the given split."""
# Create set of candidate_subclasses associated with each mention_subclass
cand_subclasses = set()
for mentions, tablename in [
- 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 display_words
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def display_words(
self,
sentences: List[Sentence],
target: Optional[str] = None,
pdf_file: Optional[str] = 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
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):
Avoid deeply nested control flow statements. Open
if not to_add:
to_add = "None"
new_pos_tags.append(to_add)
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _after_apply
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _after_apply(
self, train: bool = False, table: Table = Label, **kwargs: Any
) -> None:
# Insert all Label Keys
if train:
- 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_vert_ngrams
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_vert_ngrams(
Avoid deeply nested control flow statements. Open
if span.stable_id not in unary_tdl_feats:
unary_tdl_feats[span.stable_id] = set()
for f in get_tdl_feats(xmltree.root, sidxs):
unary_tdl_feats[span.stable_id].add(f)
for f in unary_tdl_feats[span.stable_id]:
Avoid deeply nested control flow statements. Open
if "x_wconf" not in parent.attrs:
parent["x_wconf"] = []
parent["x_wconf"].append(x_wconf)
Function clear
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def clear( # type: ignore
Avoid deeply nested control flow statements. Open
for f in multinary_tdl_feats[candidate.id]:
yield candidate.id, f"TDL_{f}", DEF_VALUE
for i, span in enumerate(spans):
Avoid deeply nested control flow statements. Open
if r.search(styles.text) is not None:
if cur_style_index is not None:
parts["html_attrs"][cur_style_index] += (
r.search(styles.text)
.group(3)
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 apply
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def apply(
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"