KarrLab/wc_utils

View on GitHub
wc_utils/workbook/io.py

Summary

Maintainability
F
1 wk
Test Coverage
B
81%

File io.py has 1167 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" IO utilities

:Author: Jonathan Karr <karr@mssm.edu>
:Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
:Date: 2016-11-28
Severity: Major
Found in wc_utils/workbook/io.py - About 3 days to fix

    Function write_worksheet has a Cognitive Complexity of 118 (exceeds 5 allowed). Consider refactoring.
    Open

        def write_worksheet(self, sheet_name, data, style=None, validation=None, protected=False, include_help_comments=False):
            """ Write worksheet to file
    
            Args:
                sheet_name (:obj:`str`): sheet name
    Severity: Minor
    Found in wc_utils/workbook/io.py - About 2 days 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 read_worksheet has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_worksheet(self, sheet_name, ignore_empty_final_rows=True, ignore_empty_final_cols=True):
            """ Read data from Excel worksheet
    
            Args:
                sheet_name (:obj:`str`): sheet name
    Severity: Minor
    Found in wc_utils/workbook/io.py - About 6 hrs 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 read_worksheet has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_worksheet(self, sheet_name, ignore_empty_final_rows=True, ignore_empty_final_cols=True):
            """ Read data from file
    
            Args:
                sheet_name (:obj:`str`): sheet name
    Severity: Minor
    Found in wc_utils/workbook/io.py - About 5 hrs 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 convert has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def convert(source, destination, worksheet_order=None, style=None, ignore_extra_sheets=True):
        """ Convert among Excel (.xlsx), comma separated (.csv), and tab separated formats (.tsv)
    
        Args:
            source (:obj:`str`): path to source file
    Severity: Minor
    Found in wc_utils/workbook/io.py - About 3 hrs 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 write_worksheet has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def write_worksheet(self, sheet_name, data, style=None, validation=None, protected=False, include_help_comments=False):
            """ Write worksheet to file
    
            Args:
                sheet_name (:obj:`str`): sheet name
    Severity: Major
    Found in wc_utils/workbook/io.py - About 3 hrs to fix

      Function get_options has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_options(self):
              """ Get options for :obj:`xlsxwriter.Worksheet.data_validation`
      
              Returns
                  :obj:`dict`: dictonary of options for :obj:`xlsxwriter.Worksheet.data_validation`
      Severity: Minor
      Found in wc_utils/workbook/io.py - About 2 hrs 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 __init__ has 20 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self,
      Severity: Major
      Found in wc_utils/workbook/io.py - About 2 hrs to fix

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

            def apply(self, ws, first_row, first_col, last_row, last_col, include_help_comments=False):
                """ Apply validation to worksheet
        
                Args:
                    ws (:obj:`xlsxwriter.Worksheet`): worksheet
        Severity: Minor
        Found in wc_utils/workbook/io.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 __init__ has 15 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, input_title='', input_message='', show_input=True,
        Severity: Major
        Found in wc_utils/workbook/io.py - About 1 hr to fix

          Function write has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def write(path, workbook,
          Severity: Major
          Found in wc_utils/workbook/io.py - About 1 hr to fix

            Function write_cell has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def write_cell(self, xls_worksheet, sheet_name, i_row, i_col, value, format):
                    """ Write a value to a cell
            
                    Args:
                        xls_worksheet (:obj:`xlsxwriter.Worksheet`): Excel worksheet
            Severity: Minor
            Found in wc_utils/workbook/io.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 get_format has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def get_format(i_row, i_col, style=style,
            Severity: Major
            Found in wc_utils/workbook/io.py - About 1 hr to fix

              Function read_cell has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def read_cell(self, sheet_name,  xls_worksheet, i_row, i_col):
                      """ Read the value of a cell
              
                      Args:
                          sheet_name (:obj:`str`): worksheet name
              Severity: Minor
              Found in wc_utils/workbook/io.py - About 55 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 write_worksheet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def write_worksheet(self, sheet_name, data, style=None, validation=None, protected=False):
                      """ Write worksheet to file
              
                      Args:
                          sheet_name (:obj:`str`): sheet name
              Severity: Minor
              Found in wc_utils/workbook/io.py - About 55 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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, path, title=None, description=None, keywords=None, version=None, language=None, creator=None):
              Severity: Major
              Found in wc_utils/workbook/io.py - About 50 mins to fix

                Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, path, title=None, description=None, keywords=None, version=None, language=None,
                Severity: Major
                Found in wc_utils/workbook/io.py - About 50 mins to fix

                  Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(self, path, title=None, description=None, keywords=None, version=None, language=None, creator=None):
                  Severity: Major
                  Found in wc_utils/workbook/io.py - About 50 mins to fix

                    Function apply has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def apply(self, ws, first_row, first_col, last_row, last_col, include_help_comments=False):
                    Severity: Minor
                    Found in wc_utils/workbook/io.py - About 45 mins to fix

                      Function write_worksheet has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def write_worksheet(self, sheet_name, data, style=None, validation=None, protected=False, include_help_comments=False):
                      Severity: Minor
                      Found in wc_utils/workbook/io.py - About 45 mins to fix

                        Function write_cell has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def write_cell(self, xls_worksheet, sheet_name, i_row, i_col, value, format):
                        Severity: Minor
                        Found in wc_utils/workbook/io.py - About 45 mins to fix

                          Function write_worksheet has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def write_worksheet(self, sheet_name, data, style=None, validation=None, protected=False):
                          Severity: Minor
                          Found in wc_utils/workbook/io.py - About 35 mins to fix

                            Function apply_validation has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def apply_validation(self, ws, first_row, first_col, last_row, last_col):
                            Severity: Minor
                            Found in wc_utils/workbook/io.py - About 35 mins to fix

                              Function convert has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              def convert(source, destination, worksheet_order=None, style=None, ignore_extra_sheets=True):
                              Severity: Minor
                              Found in wc_utils/workbook/io.py - About 35 mins to fix

                                Function write_worksheet has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    def write_worksheet(self, sheet_name, data, style=None, validation=None, protected=False):
                                Severity: Minor
                                Found in wc_utils/workbook/io.py - About 35 mins to fix

                                  Function get_sheet_names has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def get_sheet_names(self):
                                          """ Get names of files contained within path glob
                                  
                                          Returns:
                                              obj:`list` of `str`: list of file names
                                  Severity: Minor
                                  Found in wc_utils/workbook/io.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