Showing 134 of 224 total issues
Function tokens_to_ngrams
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def tokens_to_ngrams(
Function get_between_ngrams
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_between_ngrams(
Function apply
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def apply( # type: ignore
Function apply
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def apply(
self,
doc_loader: Collection[
Document
], # doc_loader has __len__, but Iterable doesn't.
- 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 _f
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _f(self, m: TemporaryContext) -> bool:
if not isinstance(m, TemporarySpanMention):
raise ValueError(
f"{self.__class__.__name__} only supports TemporarySpanMention"
)
- 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 upsert_keys
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def upsert_keys(session: Session, key_table: Table, keys: Dict) -> None:
"""Bulk add annotation keys to the specified table.
:param key_table: The sqlalchemy class to insert into.
:param keys: A map of {name: [candidate_classes]}.
- 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_boxes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def display_boxes(
self,
pdf_file: str,
boxes: List[Bbox],
alternate_colors: bool = 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 apply
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def apply(self, mentions: Iterator[TemporaryContext]) -> Iterator[TemporaryContext]:
"""Apply the Matcher to a **generator** of mentions.
Optionally only takes the longest match (NOTE: assumes this is the
*first* match)
- 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 too many return
statements within this function. Open
return False
Function _map_to_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _map_to_id(self) -> None:
self.X_dict.update(
dict([(f"m{i}", []) for i in range(len(self.candidates[0]))])
)
- 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 _after_apply
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _after_apply(self, train: bool = False, **kwargs: Any) -> None:
# Insert all Feature Keys
if train:
key_map: DefaultDict[str, set] = defaultdict(set)
for feature in self.session.query(Feature).all():
- 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 forward
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def forward(self, input: Tensor, target: Tensor) -> Tensor:
"""Calculate the loss.
:param input: prediction logits
:param target: target probabilities
- 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_ddlib_feats
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_ddlib_feats(
span: SpanMention, context: Dict[str, Any], idxs: List[int]
) -> Iterator[str]:
"""Minimalist port of generic mention features from ddlib."""
if span.stable_id not in unary_ddlib_feats:
- 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 _generate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _generate(self) -> Iterator[Document]:
"""Parse a file or directory of files into a set of ``Document`` objects."""
doc_count = 0
for fp in self.all_files:
for doc in self._get_docs_for_path(fp):
- 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"