UnB-KnEDLe/DODFMiner

View on GitHub

Showing 67 of 67 total issues

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.
Severity: Minor
Found in dodfminer/extract/pure/utils/box_extractor.py - About 25 mins to fix

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
Severity: Minor
Found in dodfminer/extract/polished/acts/base_contratos.py - About 25 mins to fix

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.
Severity: Minor
Found in dodfminer/extract/polished/helper.py - About 25 mins to fix

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.
Severity: Minor
Found in dodfminer/extract/pure/core.py - About 25 mins to fix

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.
Severity: Minor
Found in dodfminer/extract/pure/core.py - About 25 mins to fix

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 = {}

Severity: Minor
Found in dodfminer/downloader/helper.py - About 25 mins to fix

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_ = './'
Severity: Minor
Found in dodfminer/extract/polished/helper.py - About 25 mins to fix

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

Severity
Category
Status
Source
Language