choderalab/protons

View on GitHub

Showing 347 of 347 total issues

File driver.py has 3977 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8
"""
Drivers for Monte Carlo sampling of chemical states, such as tautomers and protomers.
"""
import copy
Severity: Major
Found in protons/app/driver.py - About 1 wk to fix

    File ligands.py has 2255 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # coding=utf-8
    """
    Library for parametrizing small molecules for simulation
    """
    
    
    Severity: Major
    Found in protons/app/ligands.py - About 6 days to fix

      Function addHydrogens has a Cognitive Complexity of 186 (exceeds 5 allowed). Consider refactoring.
      Open

          def addHydrogens(self, forcefield=None, pH=None, variants=None, platform=None):
              """Add missing hydrogens to the model.
      
              This function automatically changes compatible residues into their constant-pH variant if no variant is specified.:
      
      
      Severity: Minor
      Found in protons/app/modeller.py - About 3 days 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 versioneer.py has 1326 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Version: 0.18
      
      """The Versioneer - like a rocketeer, but for versions.
      
      The Versioneer
      Severity: Major
      Found in versioneer.py - About 3 days to fix

        Function _update_forces has a Cognitive Complexity of 129 (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 2 days 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 amber_parser.py has 1028 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/env python
        """
        Adapted from openmoltools: https://github.com/choderalab/openmoltools.
        
        Original license and copyright:
        Severity: Major
        Found in protons/app/amber_parser.py - About 2 days to fix

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

          def render(pieces, style):
              """Render the given version pieces into the requested style."""
              if pieces["error"]:
                  return {"version": "unknown",
                          "full-revisionid": pieces.get("long"),
          Severity: Major
          Found in versioneer.py and 1 other location - About 2 days to fix
          protons/_version.py on lines 469..503

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

          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

          def render(pieces, style):
              """Render the given version pieces into the requested style."""
              if pieces["error"]:
                  return {
                      "version": "unknown",
          Severity: Major
          Found in protons/_version.py and 1 other location - About 2 days to fix
          versioneer.py on lines 1366..1395

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

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

              def _add_isomers(self):
                  """
                  Add all the isomer specific data to the xml template.
                  """
                  log.debug("Add tautomer information ...")
          Severity: Minor
          Found in protons/app/ligands.py - About 2 days 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_prep_ffxml_main has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
          Open

          def run_prep_ffxml_main(jsonfile):
              """Main simulation loop."""
          
              log.info(f"Preparing a run from '{jsonfile}'")
          
          
          Severity: Minor
          Found in protons/scripts/run_prep_ffxml.py - About 1 day 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

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

          @register_vcs_handler("git", "get_keywords")
          def git_get_keywords(versionfile_abs):
              """Extract version information from the given file."""
              # the code embedded in _version.py can just fetch the value of these
              # keywords. When used from setup.py, we don't want to import _version.py,
          Severity: Major
          Found in protons/_version.py and 1 other location - About 1 day to fix
          versioneer.py on lines 944..970

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

          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

          @register_vcs_handler("git", "get_keywords")
          def git_get_keywords(versionfile_abs):
              """Extract version information from the given file."""
              # the code embedded in _version.py can just fetch the value of these
              # keywords. When used from setup.py, we don't want to import _version.py,
          Severity: Major
          Found in versioneer.py and 1 other location - About 1 day to fix
          protons/_version.py on lines 141..167

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

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

              def _create_chimera_template(self):
                  """
                  Start with atom types from the most populated state, and attempt to fill in the remaining atoms from the other
                  states.
                  
          Severity: Minor
          Found in protons/app/ligands.py - About 1 day 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

              @staticmethod
              def _parse_dat_dihedral_parameters(line):
                  """
                  Parse a line in a parm.dat file using dihedral format specification.
                  Parameters
          Severity: Major
          Found in protons/app/amber_parser.py and 1 other location - About 1 day to fix
          protons/app/amber_parser.py on lines 603..673

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

          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

              @staticmethod
              def _parse_dat_improper_dihedral_parameters(line):
                  """
                  Parse a line in a parm.dat file using improper dihedral format specification.
                  Parameters
          Severity: Major
          Found in protons/app/amber_parser.py and 1 other location - About 1 day to fix
          protons/app/amber_parser.py on lines 517..601

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

          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

          def render_pep440_post(pieces):
              """TAG[.postDISTANCE[.dev0]+gHEX] .
          
              The ".dev0" means dirty. Note that .dev0 sorts backwards
              (a dirty tree will appear "older" than the corresponding clean one),
          Severity: Major
          Found in versioneer.py and 1 other location - About 1 day to fix
          protons/_version.py on lines 380..404

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

          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

          def render_pep440_post(pieces):
              """TAG[.postDISTANCE[.dev0]+gHEX] .
          
              The ".dev0" means dirty. Note that .dev0 sorts backwards
              (a dirty tree will appear "older" than the corresponding clean one),
          Severity: Major
          Found in protons/_version.py and 1 other location - About 1 day to fix
          versioneer.py on lines 1277..1301

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

          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

          File analysis.py has 651 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # coding=utf-8
          """Tools for the analysis of standard data structure files."""
          import numpy as np
          from pymbar import bar
          from .logger import log
          Severity: Major
          Found in protons/app/analysis.py - About 1 day to fix

            Function prepare_mol2_for_parametrization has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
            Open

            def prepare_mol2_for_parametrization(
                input_mol2: str,
                output_mol2: str,
                patch_bonds: bool = True,
                keep_intermediate: bool = False,
            Severity: Minor
            Found in protons/app/ligands.py - About 1 day 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 proposals.py has 641 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # coding=utf-8
            """Residue selection moves for protons MC"""
            from abc import ABCMeta, abstractmethod
            from .logger import log
            import copy
            Severity: Major
            Found in protons/app/proposals.py - About 1 day to fix
              Severity
              Category
              Status
              Source
              Language