mordred-descriptor/mordred

View on GitHub

Showing 136 of 136 total issues

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 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

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          @classmethod
          def preset(cls, version):
              return (cls(h, p) for p in [False, True] for h in [True, False])
      Severity: Major
      Found in mordred/GravitationalIndex.py and 2 other locations - About 50 mins to fix
      mordred/ExtendedTopochemicalAtom.py on lines 453..455
      mordred/ExtendedTopochemicalAtom.py on lines 511..513

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 36.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def __init__(self, mols, coords, n_frags, name, config):
              self._mols = mols
              self._coords = coords
              self.n_frags = n_frags
              self.name = name
      Severity: Minor
      Found in mordred/_base/context.py and 1 other location - About 50 mins to fix
      mordred/RingCount.py on lines 132..139

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 36.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          @classmethod
          def preset(cls, version):
              return (cls(r, a) for r in [False, True] for a in [False, True])
      Severity: Major
      Found in mordred/ExtendedTopochemicalAtom.py and 2 other locations - About 50 mins to fix
      mordred/ExtendedTopochemicalAtom.py on lines 453..455
      mordred/GravitationalIndex.py on lines 19..21

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 36.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def __init__(
              self, order=None, greater=False, fused=False, aromatic=None, hetero=None
          ):
              self._order = order
              self._greater = greater
      Severity: Minor
      Found in mordred/RingCount.py and 1 other location - About 50 mins to fix
      mordred/_base/context.py on lines 10..15

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 36.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          @classmethod
          def preset(cls, version):
              return (cls(l, a) for l in [False, True] for a in [False, True])
      Severity: Major
      Found in mordred/ExtendedTopochemicalAtom.py and 2 other locations - About 50 mins to fix
      mordred/ExtendedTopochemicalAtom.py on lines 511..513
      mordred/GravitationalIndex.py on lines 19..21

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 36.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              with self.rethrow_zerodiv():
                  return 4 * Pmax * Pmin / (P * P)
      Severity: Major
      Found in mordred/KappaShapeIndex.py and 2 other locations - About 45 mins to fix
      mordred/KappaShapeIndex.py on lines 57..58
      mordred/KappaShapeIndex.py on lines 77..78

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              nu = np.sum(D[u, :] < D[v, :])
      Severity: Minor
      Found in mordred/ABCIndex.py and 1 other location - About 45 mins to fix
      mordred/ABCIndex.py on lines 82..82

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                with self.rethrow_zerodiv():
                    return 2 * Pmax * Pmin / (P * P)
        Severity: Major
        Found in mordred/KappaShapeIndex.py and 2 other locations - About 45 mins to fix
        mordred/KappaShapeIndex.py on lines 57..58
        mordred/KappaShapeIndex.py on lines 101..102

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 35.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                nv = np.sum(D[v, :] < D[u, :])
        Severity: Minor
        Found in mordred/ABCIndex.py and 1 other location - About 45 mins to fix
        mordred/ABCIndex.py on lines 81..81

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 35.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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
            Severity
            Category
            Status
            Source
            Language