choderalab/protons

View on GitHub

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

          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

          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

          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

              Function _add_xml_titration_groups has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _add_xml_titration_groups(
                      self,
                      topology: app.Topology,
                      system: mm.System,
                      forcefield: app.ForceField,
              Severity: Minor
              Found in protons/app/driver.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

              Function epik_results_to_mol2 has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
              Open

              def epik_results_to_mol2(
                  epik_mae: 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

              Function _create_hybrid_template has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _create_hybrid_template(self):
                      """
                      Interpolate differing atom types to create a single template state that has proper bonded terms for all atoms.
                      """
              
              
              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

              Function process_dat_file has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
              Open

                  def process_dat_file(self, inputfile):
                      """Process an AMBER .dat file.
              
                      Parameters
                      ----------
              Severity: Minor
              Found in protons/app/amber_parser.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 forcefield_generators.py has 513 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              #!/usr/bin/env python
              """
              OpenMM ForceField residue template generators.
              
              Adapted from openmoltools: https://github.com/choderalab/openmoltools.
              Severity: Major
              Found in protons/app/forcefield_generators.py - About 1 day to fix

                Function _cache_force has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _cache_force(self, titration_group_index, titration_state_index):
                        """
                        Cache the force parameters for a single tautomer state.
                
                        Parameters
                Severity: Minor
                Found in protons/app/driver.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

                Function generate_xml has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                Open

                    def generate_xml(self):
                        """Return the processed forcefield files as an XML stream.
                
                        Returns
                        -------
                Severity: Minor
                Found in protons/app/amber_parser.py - About 7 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 openeye.py has 493 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """Adapted from openmoltools: https://github.com/choderalab/openmoltools.
                
                Original license and copyright:
                Copyright 2017 Kyle A. Beauchamp, John D. Chodera, David L. Mobley
                
                
                Severity: Minor
                Found in protons/app/openeye.py - About 7 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language