mordred-descriptor/mordred

View on GitHub

Showing 64 of 136 total issues

File ExtendedTopochemicalAtom.py has 577 lines of code (exceeds 250 allowed). Consider refactoring.
Open

r"""Extended Topochemical Atom(ETA) descriptor.

References
    * :doi:`10.1021/ci0342066`
    * :doi:`10.1016/j.jhazmat.2013.03.023`
Severity: Major
Found in mordred/ExtendedTopochemicalAtom.py - About 1 day to fix

    File calculator.py has 355 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from __future__ import print_function
    
    import sys
    import warnings
    from types import ModuleType
    Severity: Minor
    Found in mordred/_base/calculator.py - About 4 hrs to fix

      Function calculate has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def calculate(self):
              new = Chem.RWMol(Chem.Mol())
              ids = {}
              for a in self.mol.GetAtoms():
                  if a.GetAtomicNum() == 1:
      Severity: Minor
      Found in mordred/ExtendedTopochemicalAtom.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

      File descriptor.py has 290 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import inspect
      import operator
      from abc import ABCMeta, abstractmethod
      from contextlib import contextmanager
      from distutils.version import StrictVersion
      Severity: Minor
      Found in mordred/_base/descriptor.py - About 2 hrs to fix

        File CPSA.py has 290 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        r"""charged partial surface area descriptor.
        
        References
            * :doi:`10.1021/ac00220a013`
        
        
        Severity: Minor
        Found in mordred/CPSA.py - About 2 hrs to fix

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

          def main_process(
              input, parser, output, nproc, quiet, stream, descriptor, with3D, verbosity
          ):
              mols = (m for i in input for m in parser(i))
          
          
          Severity: Minor
          Found in mordred/__main__.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_descriptors_in_module has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_descriptors_in_module(mdl, submodule=True):
              r"""Get descriptors in module.
          
              Parameters:
                  mdl(module): module to search
          Severity: Minor
          Found in mordred/_base/calculator.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

          Calculator has 25 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Calculator(object):
              r"""descriptor calculator.
          
              Parameters:
                  descs: see Calculator.register() method
          Severity: Minor
          Found in mordred/_base/calculator.py - About 2 hrs to fix

            Descriptor has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Descriptor(six.with_metaclass(DescriptorMeta, object)):
                r"""Abstract base class of descriptors.
            
                Attributes:
                    mol(rdkit.Mol): target molecule
            Severity: Minor
            Found in mordred/_base/descriptor.py - About 2 hrs to fix

              Function _get_sulfur_contrib has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _get_sulfur_contrib(cls, atom):
                      nH = cls._hydrogen_count(atom)
                      cnt = cls._bond_type_count(atom)
              
                      if atom.GetFormalCharge() != 0:
              Severity: Minor
              Found in mordred/TopoPSA.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

              File _atomic_property.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              from __future__ import division
              
              import os
              
              import six
              Severity: Minor
              Found in mordred/_atomic_property.py - About 2 hrs to fix

                Function _calculate_one has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _calculate_one(self, cxt, desc, reset):
                        if desc in self._cache:
                            return self._cache[desc]
                
                        if reset:
                Severity: Minor
                Found in mordred/_base/calculator.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 from_query has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def from_query(cls, mol, require_3D, explicit_hydrogens, kekulizes, id, config):
                        if not isinstance(mol, Chem.Mol):
                            raise TypeError("{!r} is not rdkit.Chem.Mol instance".format(mol))
                
                        n_frags = len(Chem.GetMolFrags(mol))
                Severity: Minor
                Found in mordred/_base/context.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 preset has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    def preset(cls, version):
                        for fused in [False, True]:
                            for arom in [None, True, False]:
                                for hetero in [None, True]:
                                    yield cls(None, False, fused, arom, hetero)
                Severity: Minor
                Found in mordred/RingCount.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 merge has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    def merge(self):
                        for i in range(1, len(self.Q) + 1):
                            ns, lsp = self.Q[-i]
                            common = ns & self.nodes
                            if len(common) == 0:
                Severity: Minor
                Found in mordred/DetourMatrix.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 _register has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _register(self, desc, version, ignore_3D):
                        if not hasattr(desc, "__iter__"):
                            if is_descriptor_class(desc):
                                if desc.since > version:
                                    return
                Severity: Minor
                Found in mordred/_base/calculator.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 _bond_ids_to_atom_ids has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _bond_ids_to_atom_ids(self, p):
                        it = iter(p)
                
                        try:
                            a0f, a0t = self._bonds[next(it)]
                Severity: Minor
                Found in mordred/PathCount.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 main_process has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def main_process(
                Severity: Major
                Found in mordred/__main__.py - About 1 hr to fix

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

                      def _code(self, tree, before, trail):
                          if len(tree) == 0:
                              yield trail
                  
                          else:
                  Severity: Minor
                  Found in mordred/InformationContent.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 _register_one has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _register_one(self, desc, check_only=False, ignore_3D=False):
                          if not isinstance(desc, Descriptor):
                              raise ValueError("{!r} is not descriptor".format(desc))
                  
                          if ignore_3D and desc.require_3D:
                  Severity: Minor
                  Found in mordred/_base/calculator.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

                  Severity
                  Category
                  Status
                  Source
                  Language