Showing 15 of 15 total issues
File run_benchmarking.py
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# coding:utf-8
"""
Runs a benchmarking suite to compare speed
and output of different implementations.
Function __init__
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __call__
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, annotated_text: Dict[str, Any]) -> str:
tag_indices = defaultdict(list)
for start, end, label in sorted(annotated_text["label"]):
tag_indices[start].append(label)
- 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 cli
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def cli() -> None:
"""Run the inscript command line client."""
args = parse_command_line()
if not (html_content := get_html_content(args.input, args.timeout, args.encoding)):
print("ERROR: Cannot open input file '{0}'.".format(args.input))
- 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 benchmark
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def benchmark(args, source_list):
"""
Run the benchmark.
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 __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _parse_html_tree
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _parse_html_tree(self, state: HtmlDocumentState, tree) -> Canvas:
"""Parse the HTML tree.
Args:
tree: the HTML tree to parse.
- 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_annotations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_annotations(self, idx: int, row_width: int) -> List[Annotation]:
"""Return a list of all annotations within the TableCell.
Returns:
A list of annotations that have been adjusted to the cell's
- 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 close_tag
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def close_tag(self, tag: HtmlElement) -> None:
"""Register that the given tag tag is closed.
Args:
tag: the tag to close.
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _parse(model: dict) -> Tuple[Dict, List]:
"""Compute the AnnotationModel from a model dictionary.
Returns:
the AnnotationModel matching the input dictionary.
- 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_refined_html_element
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_refined_html_element(self, new: "HtmlElement") -> "HtmlElement":
"""Compute the new HTML element based on the previous one.
Adaptations:
margin_top: additional margin required when considering
- 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 horizontal_shift
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def horizontal_shift(
Function merge_normal_text
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def merge_normal_text(self, text: str) -> None:
"""Merge the given text with the current block.
Args:
text: the text to merge
- 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 _set_column_width
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _set_column_width(self):
"""Set the column width for all :class:`TableCell`s in the table."""
# determine maximum number of columns
max_columns = max((len(row.columns) for row in self.rows))
- 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_annotations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_annotations(self, idx: int, left_margin_len: int) -> List[Annotation]:
r"""Return all annotations in the given table.
Args:
idx: the table's start index.
- 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"