bjmorgan/vasppy

View on GitHub

Showing 40 of 55 total issues

Function print_forces has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def print_forces(self):
        for theseforces in self.forces:
            output_str = [f"  {force: .6f}" for force in theseforces]
            for force in theseforces:
                if abs(force) > self.convergence:
Severity: Minor
Found in vasppy/scripts/checkforce.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_plus_u has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def print_plus_u(self):
        if "LDAUU" in self.vasprun.incar:
            lqn = {0: "s", 1: "p", 2: "d", 3: "f"}
            ldauu = self.vasprun.incar["LDAUU"]
            ldauj = self.vasprun.incar["LDAUJ"]
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

Function weighted_band_structure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def weighted_band_structure(
        self,
        spins=None,
        ions=None,
        orbitals=None,
Severity: Minor
Found in vasppy/procar.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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in vasppy/rdf.py - About 50 mins to fix

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in vasppy/doscar.py - About 50 mins to fix

      Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Minor
      Found in vasppy/rdf.py - About 45 mins to fix

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

        def main():
            args = parse_command_line_arguments()
            poscar = Poscar.from_file(args.poscar)
            potcars = potcar_spec(args.potcar)
            for i, (species, potcar) in enumerate(zip(poscar.atoms, potcars, strict=True), 1):
        Severity: Minor
        Found in vasppy/scripts/check_species.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

        Function weighted_band_structure has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def weighted_band_structure(
        Severity: Minor
        Found in vasppy/procar.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if return_hashes:
                                  p_spec[p] = this_md5sum
                              else:
                                  p_spec[p] = ps
              if len(p_spec) != len(potcar_md5sums):
          Severity: Major
          Found in vasppy/summary.py - About 45 mins to fix

            Function print_weighted_band_structure has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def print_weighted_band_structure(
            Severity: Minor
            Found in vasppy/procar.py - About 45 mins to fix

              Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, title, description, status, notes=None, type=None, track=None):
              Severity: Minor
              Found in vasppy/vaspmeta.py - About 45 mins to fix

                Function to_matrix has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def to_matrix(xx, yy, zz, xy, yz, xz):
                Severity: Minor
                Found in vasppy/optics.py - About 45 mins to fix

                  Function murnaghan has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def murnaghan(vol, e0, b0, bp, v0):
                  Severity: Minor
                  Found in vasppy/scripts/murnfit.py - About 35 mins to fix

                    Function effective_mass_calc has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def effective_mass_calc(
                    Severity: Minor
                    Found in vasppy/procar.py - About 35 mins to fix

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

                      def main() -> None:
                          args = parse_args()
                      
                          structure = Structure.from_file(args.poscar)
                          reciprocal_lattice_vectors = structure.lattice.reciprocal_lattice_crystallographic.matrix
                      Severity: Minor
                      Found in vasppy/scripts/convergence_testing.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def main():
                          args = parse_command_line_arguments()
                          if args.hash:
                              hashes = {}
                              for p, md5hash in potcar_spec(args.potcar, return_hashes=True).items():
                      Severity: Minor
                      Found in vasppy/scripts/potcar_spec.py - About 35 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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __init__(
                              self,
                              structures: list[Structure],
                              indices_i: list[int],
                              indices_j: Optional[list[int]] = None,
                      Severity: Minor
                      Found in vasppy/rdf.py - About 35 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 handle_occupancy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def handle_occupancy(occupancy, negative_occupancies="warn"):
                          valid_negative_occupancies = ["warn", "raise", "ignore", "zero"]
                          if negative_occupancies not in valid_negative_occupancies:
                              raise ValueError(
                                  "valid options for negative_occupancies are {}".format(
                      Severity: Minor
                      Found in vasppy/band.py - About 35 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 pdos_column_names has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def pdos_column_names(lmax: int, ispin: int) -> List[str]:
                          if lmax == 2:
                              names = ["s", "p_y", "p_z", "p_x", "d_xy", "d_yz", "d_z2-r2", "d_xz", "d_x2-y2"]
                          elif lmax == 3:
                              names = [
                      Severity: Minor
                      Found in vasppy/doscar.py - About 35 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 __add__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __add__(self, other):
                              if self.spin_channels != other.spin_channels:
                                  raise ValueError(
                                      "Can only concatenate Procars with equal spin_channels: {}, {}".format(
                                          self.spin_channels, other.spin_channels
                      Severity: Minor
                      Found in vasppy/procar.py - About 35 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

                      Severity
                      Category
                      Status
                      Source
                      Language