mordred-descriptor/mordred

View on GitHub

Showing 64 of 136 total issues

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

    def calculate(self):
        L = 0
        pi = 0

        self._gen_bonds()
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 _get_phosphorus_contrib has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_phosphorus_contrib(cls, atom):
        nH = cls._hydrogen_count(atom)
        cnt = cls._bond_type_count(atom)

        if atom.GetFormalCharge() != 0 or atom.GetIsAromatic():
Severity: Minor
Found in mordred/TopoPSA.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 _from_json has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def _from_json(obj, descs):
    name = obj.get("name")
    args = obj.get("args") or {}
    if name is None:
        raise ValueError("invalid json: {}".format(obj))
Severity: Minor
Found in mordred/_base/__init__.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 main has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def main(out):
    wb = Workbook()
    ws = wb.active
    ws.title = "descriptors"

Severity: Minor
Found in docs/scripts/gen_descriptor_list_xlsx.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 parallel has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def parallel(calc, mols, nproc, nmols, quiet, ipynb, id):
Severity: Major
Found in mordred/_base/parallel.py - About 50 mins to fix

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

    def doi_role(name, rawtext, text, lineno, inliner, options={}, context=[]):
    Severity: Major
    Found in docs/conf.py - About 50 mins to fix

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

          def pandas(self, mols, nproc=None, nmols=None, quiet=False, ipynb=False, id=-1):
      Severity: Minor
      Found in mordred/_base/calculator.py - About 45 mins to fix

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

            def description(self):
                if self._order is None:
                    o = ""
                elif self._greater:
                    o = "{}-or-greater-membered ".format(self._order)
        Severity: Minor
        Found in mordred/RingCount.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 map has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def map(self, mols, nproc=None, nmols=None, quiet=False, ipynb=False, id=-1):
        Severity: Minor
        Found in mordred/_base/calculator.py - About 45 mins to fix

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

              def from_query(cls, mol, require_3D, explicit_hydrogens, kekulizes, id, config):
          Severity: Minor
          Found in mordred/_base/context.py - About 45 mins to fix

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

            def autodoc_process_docstring(app, what, name, obj, options, lines):
            Severity: Minor
            Found in docs/conf.py - About 45 mins to fix

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

                  def _serial(self, mols, nmols, quiet, ipynb, id):
              Severity: Minor
              Found in mordred/_base/calculator.py - About 35 mins to fix

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

                    def __init__(self, mols, coords, n_frags, name, config):
                Severity: Minor
                Found in mordred/_base/context.py - About 35 mins to fix

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

                      def __init__(
                  Severity: Minor
                  Found in mordred/RingCount.py - About 35 mins to fix

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

                        def __str__(self):
                            attrs = []
                    
                            if self._greater:
                                attrs.append("G")
                    Severity: Minor
                    Found in mordred/RingCount.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 __new__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def __new__(cls, classname, bases, dict):
                            __init__ = dict.get("__init__")
                            if __init__ is None:
                                for base in bases:
                                    __init__ = getattr(base, "__init__", None)
                    Severity: Minor
                    Found in mordred/_base/descriptor.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 calculate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def calculate(self, P, chi=None):
                            if self._order <= 0:
                                chi = ChiBonds([], [{a.GetIdx()} for a in self.mol.GetAtoms()], [], [])
                    
                            x = 0.0
                    Severity: Minor
                    Found in mordred/Chi.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 __call__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def __call__(self):
                            timeout_at = None if self.timeout is None else time.time() + self.timeout
                    
                            for bcc in networkx.biconnected_component_subgraphs(self.G, False):
                                lsp = LongestSimplePath(bcc, self.weight, timeout_at)()
                    Severity: Minor
                    Found in mordred/DetourMatrix.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 calculate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def calculate(self, An=None, T=None, W=None):
                            if self._total:
                                if self._order == 1:
                                    return self.mol.GetNumAtoms() + W
                    
                    
                    Severity: Minor
                    Found in mordred/WalkCount.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 np.log(An.sum() + 1)
                    Severity: Major
                    Found in mordred/WalkCount.py - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language