UnB-KnEDLe/DODFMiner

View on GitHub
dodfminer/extract/polished/helper.py

Summary

Maintainability
C
1 day
Test Coverage

File helper.py has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Polished extraction helper functions.

Functions in this files can be used inside, or outside, the ActsExtractor
class. Their purpose is to make some tasks easier for the user,
like creating txts, searching through files, and print dataframes.
Severity: Minor
Found in dodfminer/extract/polished/helper.py - About 2 hrs to fix

    Function extract_multiple_acts_with_committee has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def extract_multiple_acts_with_committee(path, types, backend):
        """Extract multple Acts from Multiple DODFs to act named CSVs.
        Uses committee_classification to find act types.
    
        Args:
    Severity: Minor
    Found in dodfminer/extract/polished/helper.py - About 1 hr 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_multiple_acts_parallel has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def extract_multiple_acts_parallel(path: str, types: List[str], backend: str, processes = 4):
        """Extract multple Acts from Multiple DODFs to act named CSVs in parallel.
    
        Args:
            path (str): Folder where the Dodfs are.
    Severity: Minor
    Found in dodfminer/extract/polished/helper.py - About 1 hr 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_multiple_acts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def extract_multiple_acts(path, types, backend):
        """Extract multple Acts from Multiple DODFs to act named CSVs.
    
        Args:
            path (str): Folder where the Dodfs are.
    Severity: Minor
    Found in dodfminer/extract/polished/helper.py - About 1 hr 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_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,
    Severity: Minor
    Found in dodfminer/extract/polished/helper.py - About 45 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_multiple has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def extract_multiple(files, act_type, backend, txt_out=False, txt_path="./results"):
    Severity: Minor
    Found in dodfminer/extract/polished/helper.py - About 35 mins to fix

      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.
      
      
      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 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 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

      There are no issues that match your filters.

      Category
      Status