choderalab/protons

View on GitHub

Showing 347 of 347 total issues

Function __init__ has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(
        self,
        temperature,
        topology,
        system,
Severity: Minor
Found in protons/app/driver.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

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

        elif kindnb.upper() == "RE":
            r = line[10:20].strip()
            # prevent IndexError from line being too short
            try:
                edep = line[20:30].split()[0].strip()
Severity: Major
Found in protons/app/amber_parser.py and 1 other location - About 4 hrs to fix
protons/app/amber_parser.py on lines 899..905

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

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

    def process_library_file(self, inputfile):
        """Process an AMBER .lib file.

        Parameters
        ----------
Severity: Minor
Found in protons/app/amber_parser.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

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

        elif kindnb.upper() == "AC":
            a = line[10:20].strip()
            # prevent IndexError from line being too short
            try:
                c = line[20:30].split()[0].strip()
Severity: Major
Found in protons/app/amber_parser.py and 1 other location - About 4 hrs to fix
protons/app/amber_parser.py on lines 892..898

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

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

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

        for i in range(number_R_steps):
            self.addComputePerDof("x", "x + ((dt / {}) * v)".format(number_R_steps * 2))
            self.addComputePerDof("x1", "x")  # save pre-constraint positions in x1
            self.addConstrainPositions()  # x is now constrained
            self.addComputePerDof(
Severity: Major
Found in protons/app/integrators.py and 1 other location - About 4 hrs to fix
protons/app/integrators.py on lines 148..155

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

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

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

        for i in range(number_R_steps):
            self.addComputePerDof("x", "x + ((dt / {}) * v)".format(number_R_steps * 2))
            self.addComputePerDof("x1", "x")  # save pre-constraint positions in x1
            self.addConstrainPositions()  # x is now constrained
            self.addComputePerDof(
Severity: Major
Found in protons/app/integrators.py and 1 other location - About 4 hrs to fix
protons/app/integrators.py on lines 134..141

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

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

    def serialize(self, index=None):
        """Serialize a state into xml etree.

        Returns
        -------
Severity: Minor
Found in protons/app/driver.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 check_for_errors has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def check_for_errors(outputtext, other_errors=None, ignore_errors=None):
    """Check AMBER package output for the string 'ERROR' (upper or lowercase) and (optionally) specified other strings and raise an exception if it is found (to avoid silent failures which might be noted to log but otherwise ignored).

    Parameters
    ----------
Severity: Minor
Found in protons/app/amber.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 __init__ has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(
        self,
        temperature,
        topology,
        system,
Severity: Minor
Found in protons/app/driver.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 generateForceFieldFromMolecules has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def generateForceFieldFromMolecules(
    molecules,
    ignoreFailures=False,
    generateUniqueNames=False,
    normalize=True,
Severity: Minor
Found in protons/app/forcefield_generators.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 _resolve_types has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def _resolve_types(bonded_to, params, type_list):
        """

        Parameters
        ----------
Severity: Minor
Found in protons/app/ligands.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 run_parametrize_main has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

def run_parametrize_main(inputfile):
    """
    Run the program
    Parameters
    ----------
Severity: Minor
Found in protons/scripts/run_parametrize_ligand.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

File run_prep_ffxml.py has 336 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# This script instantiates a file for running constant-pH simulation

import os
import signal
import sys
Severity: Minor
Found in protons/scripts/run_prep_ffxml.py - About 4 hrs to fix

    File modeller.py has 329 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # coding=utf-8
    """Pre-configured OpenMM Modeller object for use with the default protons forcefield. Modified from original source code by Peter Eastman."""
    
    from .topology import Topology
    from simtk.openmm.app import modeller
    Severity: Minor
    Found in protons/app/modeller.py - About 3 hrs to fix

      Function _update_forces has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def _update_forces(
              self,
              titration_group_index,
              final_titration_state_index,
              initial_titration_state_index=None,
      Severity: Minor
      Found in protons/app/driver.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 get_charges has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_charges(
          molecule,
          max_confs=800,
          strictStereo=True,
          normalize=True,
      Severity: Minor
      Found in protons/app/openeye.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 __eq__ has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def __eq__(self, other):
              """Compare the equality of two _TitrationState objects."""
              if not isinstance(other, _TitrationState):
                  return False
      
      
      Severity: Minor
      Found in protons/app/driver.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 _update has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def _update(self, pool=None, move=None, endUpdate=None, endTime=None):
      
              if move is None:
                  move = self.move
              if endUpdate is None:
      Severity: Minor
      Found in protons/app/simulation.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 _scan has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def _scan(self, endTime=None):
              """Systematic scan over all protonation states possible."""
              numScanStates: int = np.product([len(r) for r in self.drive.titrationGroups])
              if numScanStates > sys.maxsize:
                  raise ValueError(
      Severity: Minor
      Found in protons/app/simulation.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

      _TitrationAttemptData has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class _TitrationAttemptData(object):
          """Private class for bookkeeping information regarding a single titration state update."""
      
          def __init__(self):
              """Set up all internal variables for tracking."""
      Severity: Minor
      Found in protons/app/driver.py - About 3 hrs to fix
        Severity
        Category
        Status
        Source
        Language