KarrLab/wc_utils

View on GitHub

Showing 93 of 115 total issues

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 assert_value_equal has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
    Open

    def assert_value_equal(obj1, obj2, check_type=False, check_iterable_ordering=False):
        """ Recursively raise an exception if two objects have different semantic values, ignoring
    
        * key/attribute order
        * optionally, object types
    Severity: Minor
    Found in wc_utils/util/types.py - About 1 day 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 memoize has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
    Open

        def memoize(self, name=None, typed=False, expire=None, tag=None, filename_args=None, filename_kwargs=None):
            """ Memoizing cache decorator
    
            Args:
                name (:obj:`str`, optional): name given for callable
    Severity: Minor
    Found in wc_utils/cache.py - About 1 day 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

    File misc.py has 364 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """ Miscellaneous utilities.
    
    :Author: Jonathan Karr <karr@mssm.edu>
    :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
    :Date: 2016-11-05
    Severity: Minor
    Found in wc_utils/util/misc.py - About 4 hrs to fix

      Method run has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

           public static java.lang.Object run(String inStructure, String inStructureFormat, String outImageFormat,
              int[] atomsToLabel, String[] atomElements, String[] atomLabels, int[] atomLabelColors, double atomLabelFontSize,
              int[][] atomSets, String[][] atomSetElements, int[] atomSetColors, 
              int[][][] bondSets, String[][][] bondSetElements, int[] bondSetColors, 
              boolean showAtomNums,
      Severity: Minor
      Found in wc_utils/util/chem/DrawMolecule.java - About 4 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 repo_suitability has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

      def repo_suitability(repo, repo_type, data_file=None):
          """ Evaluate whether a repo is a suitable source for git metadata
      
          Determine whether `repo` is in a state that's suitable for collecting immutable metadata.
          It cannot be ahead of the remote, because commits must have been pushed to
      Severity: Minor
      Found in wc_utils/util/git.py - About 4 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 are_units_equivalent has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      def are_units_equivalent(units1, units2, check_same_magnitude=True):
          """ Determine if two units are equivalent
      
          Args:
              units1 (:obj:`pint.unit._Unit`): units
      Severity: Minor
      Found in wc_utils/util/units.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 __indent_forest has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      def __indent_forest(forest, indentation, depth, keep_trailing_blank_lines):
          """ Private, recursive method to generate a list of lines indented by their depth in a forest
      
          Args:
              forest (:obj:`list` of :obj:`list`): a forest as an iterator of nested iterators
      Severity: Minor
      Found in wc_utils/util/string.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

        File core.py has 306 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """ Read configuration settings from files, environment variables, and function arguments
        
        :Author: Jonathan Karr <karr@mssm.edu>
        :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
        :Date: 2016-10-25
        Severity: Minor
        Found in wc_utils/config/core.py - About 3 hrs to fix

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

              def from_dict(config):
                  """ Create and configure logs from a dictionary which describes their configuration
          
                  Caution: because `logging2.Logger()` caches handlers and loggers, `from_dict()` may not create
                  a logger with the configuration requested. In particular, creating a logger that has the same
          Severity: Minor
          Found in wc_utils/debug_logs/config.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 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 get_config has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_config(self, extra=None, context=None):
                  """ Setup configuration from config file(s), environment variables, and/or function arguments.
          
                  1. Setup configuration from default values specified in `paths.default`.
                  2. If `paths.user` is set, find the first file in it that exists, and override
          Severity: Minor
          Found in wc_utils/config/core.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

            Method run has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                 public static java.lang.Object run(String inStructure, String inStructureFormat, String outImageFormat,
                    int[] atomsToLabel, String[] atomElements, String[] atomLabels, int[] atomLabelColors, double atomLabelFontSize,
                    int[][] atomSets, String[][] atomSetElements, int[] atomSetColors, 
                    int[][][] bondSets, String[][][] bondSetElements, int[] bondSetColors, 
                    boolean showAtomNums,
            Severity: Major
            Found in wc_utils/util/chem/DrawMolecule.java - About 2 hrs to fix

              File core.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              """ Excel utilities
              
              :Author: Jonathan Karr <karr@mssm.edu>
              :Date: 2016-11-28
              :Copyright: 2016-2018, Karr Lab
              Severity: Minor
              Found in wc_utils/workbook/core.py - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language