KarrLab/wc_kb

View on GitHub

Showing 44 of 94 total issues

Function get_empirical_formula has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def get_empirical_formula(self, cds=True):
        """ Get the empirical formula

        Returns:
            :obj:`chem.EmpiricalFormula`: empirical formula
Severity: Minor
Found in wc_kb/prokaryote.py - About 1 hr to fix

    Function validate_implicit_relationships_are_set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_implicit_relationships_are_set(self, knowledge_base):
            """ Check that there is only 1 :obj:`KnowledgeBase` and <= 1 :obj:`Cell` and that each relationship
            to :obj:`KnowledgeBase` and :obj:`Cell` is set. This is necessary to enable the :obj:`KnowledgeBase` and
            :obj:`Cell` relationships to be implicit in the Excel output and added by :obj:`Reader.run`
    
    
    Severity: Minor
    Found in wc_kb/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_direction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_direction(self):
            """ Returns the direction of the polymer feature defind by its strand and start/end coordinate
                Returns:
                    :obj:`str`: direction (in ['forward', 'reverse'])
    
    
    Severity: Minor
    Found in wc_kb/prokaryote.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_direction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_direction(self):
            """ Returns the direction of the polymer feature defind by its strand and start/end coordinate
    
                Returns:
                    :obj:`PolymerDirection`: direction (in ['forward', 'reverse'])
    Severity: Minor
    Found in wc_kb/core.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 serialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def serialize(self, participants, encoded=None):
            """ Serialize related object
    
            Args:
                participants (:obj:`list` of :obj:`SpeciesCoefficient`): Python representation of reaction participants
    Severity: Minor
    Found in wc_kb/core.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 create_template has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def create_template(core_path, seq_path, taxon='prokaryote', write_schema=False, write_toc=True,
    Severity: Major
    Found in wc_kb/io.py - About 1 hr to fix

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

      def convert(source_core, source_seq, dest_core, dest_seq, taxon='prokaryote', rewrite_seq_path=True, protected=True):
      Severity: Major
      Found in wc_kb/io.py - About 50 mins to fix

        Function remove_metadata has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def remove_metadata(kb):
                """ Remove metadata from Knowledge base
        
                Args:
                    kb (:obj:`wc_utils.workbook.Workbook`): knowledge base
        Severity: Minor
        Found in wc_kb/__main__.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

        Avoid deeply nested control flow statements.
        Open

                            if cell.value and isinstance(cell.value, str):
                                cell.value = '!' + cell.value
                else:
        Severity: Major
        Found in migrations/migration_2019_09_20.py - About 45 mins to fix

          Function deserialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def deserialize(self, value, objects, decoded=None):
                  """ Deserialize value
                  Args:
                      value (:obj:`str`): String representation
                      objects (:obj:`dict`): dictionary of objects, grouped by model
          Severity: Minor
          Found in wc_kb/core.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

          Avoid deeply nested control flow statements.
          Open

                              if cell.value and isinstance(cell.value, str):
                                  cell.value = '!' + cell.value
          
          
          Severity: Major
          Found in migrations/migration_2019_09_20.py - About 45 mins to fix

            Function transform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def transform(filename, taxon):
                # read
                wb = openpyxl.load_workbook(filename=filename)
            
                for ws in wb:
            Severity: Minor
            Found in migrations/migration_2020_04_27.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 deserialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def deserialize(self, value, objects, decoded=None):
                    """ Deserialize value
                    Args:
                        value (:obj:`str`): String representation
                        objects (:obj:`dict`): dictionary of objects, grouped by model
            Severity: Minor
            Found in wc_kb/eukaryote.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 deserialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def deserialize(cls, attribute, value, objects, compartment=None):
            Severity: Minor
            Found in wc_kb/core.py - About 35 mins to fix

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

                  def calc_structure(self, ph=7.4, major_tautomer=False, keep_hydrogens=False, dearomatize=False):
              Severity: Minor
              Found in wc_kb/core.py - About 35 mins to fix

                Function _serialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _serialize(species, coefficient, show_compartment=True, show_coefficient_sign=True):
                        """ Serialize values
                
                        Args:
                            species (:obj:`Species`): species
                Severity: Minor
                Found in wc_kb/core.py - About 35 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 _append_metadata_entries has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _append_metadata_entries(self, key, metadataObjs):
                        """ Appends wc_kb.core.Reference / wc_kb.core.DatabaseReference / wc_kb.core.Comments objects
                            to metadataObjs list
                
                            Input:
                Severity: Minor
                Found in wc_kb/core.py - About 35 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_subseq has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_subseq(self, start, end, strand=PolymerStrand.positive):
                        """ Get a subsequence
                
                        Args:
                            start (:obj:`int`): start coordinate (1-indexed)
                Severity: Minor
                Found in wc_kb/core.py - About 35 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

                Avoid too many return statements within this function.
                Open

                            return float(self.value)
                Severity: Major
                Found in wc_kb/core.py - About 30 mins to fix

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

                      def _default(self):
                          args = self.app.pargs
                  
                          if args.compare_files:
                              kb1 = wc_utils.workbook.io.read(args.core_path_1)
                  Severity: Minor
                  Found in wc_kb/__main__.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