bjmorgan/vasppy

View on GitHub

Showing 40 of 55 total issues

File procar.py has 558 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from functools import reduce
from copy import deepcopy
from typing import Optional
import warnings
import math
Severity: Major
Found in vasppy/procar.py - About 1 day to fix

    Function main has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

    def main():
        supported_flags = Summary.supported_flags
        to_print = [
            "title",
            "status",
    Severity: Minor
    Found in vasppy/scripts/vasp_summary.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

    Function plot_pdos has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def plot_pdos(
            self,
            ax: Optional[Axes] = None,
            to_plot: Optional[Dict[str, List[str]]] = None,
            colors: Optional[Iterable] = None,
    Severity: Minor
    Found in vasppy/doscar.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 doscar.py has 329 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import numpy as np
    import pandas as pd  # type: ignore
    import matplotlib.pyplot as plt  # type: ignore
    from matplotlib.axes import Axes  # type: ignore
    from matplotlib.figure import Figure  # type: ignore
    Severity: Minor
    Found in vasppy/doscar.py - About 3 hrs to fix

      Summary has 31 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Summary:
          """
          TODO Document Summary class
          """
      
      
      Severity: Minor
      Found in vasppy/summary.py - About 3 hrs to fix

        File summary.py has 324 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Summary class and helper methods
        # Used for summarising VASP calculations as YAML
        
        from pymatgen.io.vasp.outputs import Vasprun  # type: ignore
        from pymatgen.analysis.transition_state import NEBAnalysis  # type: ignore
        Severity: Minor
        Found in vasppy/summary.py - About 3 hrs to fix

          Function output_coordinates_only has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              def output_coordinates_only(self, coordinate_type="Direct", opts=None):
                  prefix = []
                  suffix = []
                  for i in range(self.coordinates.shape[0]):
                      prefix_string = ""
          Severity: Minor
          Found in vasppy/poscar.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

          Poscar has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Poscar:
              lines_offset = 9
          
              def __init__(self):
                  self.title = "Title"
          Severity: Minor
          Found in vasppy/poscar.py - About 3 hrs to fix

            Function pdos_select has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                def pdos_select(
                    self,
                    atoms: Optional[Union[int, List[int]]] = None,
                    spin: Optional[str] = None,
                    l: Optional[str] = None,
            Severity: Minor
            Found in vasppy/doscar.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

            File poscar.py has 284 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import numpy as np
            import sys
            import re
            import copy
            from vasppy import cell
            Severity: Minor
            Found in vasppy/poscar.py - About 2 hrs to fix

              Procar has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Procar:
                  """
                  Object for working with PROCAR data.
              
                  Attributes:
              Severity: Minor
              Found in vasppy/procar.py - About 2 hrs to fix

                Function replicate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    def replicate(self, h, k, l, group=False):
                        lattice_scaling = np.array([h, k, l], dtype=float)
                        lattice_shift = np.reciprocal(lattice_scaling)
                        new_poscar = Poscar()
                        new_poscar.title = self.title
                Severity: Minor
                Found in vasppy/poscar.py - About 2 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_forces_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_forces_data(outcar_filename="OUTCAR", convergence=None, warn=False):
                    """Parse an OUTCAR file and return forces data, includig various summary statistics.
                
                    args:
                        outcar_filename (optional, `str`): OUTCAR filename. Default is "OUTCAR".
                Severity: Minor
                Found in vasppy/scripts/checkforce.py - About 2 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 potcar_spec has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                def potcar_spec(filename, return_hashes=False):
                    """
                    Returns a dictionary specifying the pseudopotentials contained in a POTCAR file.
                
                    Args:
                Severity: Minor
                Found in vasppy/summary.py - About 2 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 import_calculations_from_file has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                def import_calculations_from_file(filename, skip_incomplete_records=False):
                    """
                    Construct a list of :obj:`Calculation` objects by reading a YAML file.
                    Each YAML document should include ``title``, ``stoichiometry``, and ``energy`` fields, e.g.::
                
                
                Severity: Minor
                Found in vasppy/calculation.py - About 2 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 dr_ij has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                def dr_ij(
                    structure: Structure,
                    indices_i: Optional[List[int]] = None,
                    indices_j: Optional[List[int]] = None,
                    self_reference: bool = False,
                Severity: Minor
                Found in vasppy/utils.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 plot_pdos has 13 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def plot_pdos(
                Severity: Major
                Found in vasppy/doscar.py - About 1 hr to fix

                  Function main has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def main():
                      args = parse_command_line_arguments()
                      coordinate_types = {
                          "d": "Direct",
                          "direct": "Direct",
                  Severity: Minor
                  Found in vasppy/scripts/proc_poscar.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 read_data has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def read_data(verbose=True):
                      dir_list = find_vasp_calculations()
                      if not dir_list:
                          raise ValueError(
                              "Did not find any subdirectories containing vasprun.xml or vasprun.xml.gz files"
                  Severity: Minor
                  Found in vasppy/scripts/murnfit.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 print_file_tracking has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def print_file_tracking(self):
                          if self.meta.track:
                              print("file tracking:")
                              for f, new_filename in self.meta.track.items():
                                  print("    {}:".format(f))
                  Severity: Minor
                  Found in vasppy/summary.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

                  Severity
                  Category
                  Status
                  Source
                  Language