Showing 59 of 67 total issues
Avoid deeply nested control flow statements. Open
if is_json:
list_of_boxes.append((text[0], text[1], text[2],
text[3], norm_text))
else:
drawboxes_text += (norm_text + sep)
Function _extract_acts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _extract_acts(self, text, prediction):
"""Extract and join words predicted to be part of an act.
Args:
text (list): List of words in the text of a DODF.
- 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
if offset_sum != -1:
offset_prop = offset + offset_sum
child_annotation = self._annotate(prop_type,
value, offset_prop)
root_passage.append(child_annotation)
Avoid deeply nested control flow statements. Open
if re.search(r'(?:ADITIVO)', titulo) is None:
if re.search(regex_titulo_contrato, titulo) is not None:
if 'termo aditivo ao contrato' not in section_3[orgao][documento][ato]['texto'].lower():
atos_contrato_convenio['numero_dodf'].append(file['json']['nu_numero'])
atos_contrato_convenio['titulo'].append(titulo)
Avoid deeply nested control flow statements. Open
if cand.label_ == 'PER':
break
Avoid deeply nested control flow statements. Open
if section and (title not in content_dict[section].keys()):
content_dict[section].update(
{normalized_title: []})
else:
Function extract_multiple
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extract_multiple(files, act_type, backend, txt_out=False, txt_path="./results"):
"""Extract Act from Multiple DODF to a single DataFrame.
Note:
This function might save data to disc in text format,
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, file, backend, debug=False, extra_search=True, pipeline = None):
Function extract_multiple
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def extract_multiple(files, act_type, backend, txt_out=False, txt_path="./results"):
Function _standard_props
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _standard_props(self):
act = {}
file = self._file_name.split('/')[-1] if self._file_name else None
match = re.search(r'(\d+\-\d+\-\d+)',file) if file else 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 _find_prop_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _find_prop_value(self, rule, act):
"""Returns named group, or the whole match if no named groups
are present on the match.
Args:
match: a re.Match object
- 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_files_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_files_path(path, file_type):
"""Get all files path inside a folder.
Works with nested folders.
- 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 _extract_page_lines_content
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _extract_page_lines_content(page):
"""Extracts page lines.
Args:
page: fitz.fitz.Page object to have its bold content extracted.
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load(self):
# Load model
if self.pipeline is None:
f_path = os.path.dirname(__file__)
f_path += self.model_path
- 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 committee_classification
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def committee_classification(all_acts, path, types, backend):
"""Uses committee classification to find act types.
Args:
all_acts (DataFrame): Dataframe with acts text and regex type.
- 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_pdfs_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_pdfs_list(cls, folder):
"""Get DODFs list from the path.
Args:
folder: The folder containing the PDFs to be extracted.
- 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 extract_to_txt
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_to_txt(cls, folder='./', norm='NFKD'):
"""Extract information from DODF to a .txt file.
For each PDF file in data/DODFs, the method extracts information from the
PDF and writes it to the .txt file.
- 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_downloads
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_downloads(year, month):
if "_" in month:
url2, dodfs = req2(req1(year), month)
_links = {}
- 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 xml_multiple
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def xml_multiple(path, backend):
files = []
if os.path.isfile(path):
files = [path]
path_ = './'
- 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"