bjmorgan/vasppy

View on GitHub

Showing 55 of 55 total issues

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

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

            if vel_dump_log:
                velocities = lines_to_numpy_array(
                    file_data[4 + number_of_atoms : 4 + number_of_atoms * 2]
        Severity: Minor
        Found in vasppy/pimaim.py and 1 other location - About 45 mins to fix
        vasppy/scripts/pimaim_to_poscar.py on lines 50..51

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

        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

        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

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

              velocities = lines_to_numpy_array(
                  file_data[4 + number_of_atoms : 4 + number_of_atoms * 2]
          Severity: Minor
          Found in vasppy/scripts/pimaim_to_poscar.py and 1 other location - About 45 mins to fix
          vasppy/pimaim.py on lines 25..27

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

          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 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 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 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 __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

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

              Severity
              Category
              Status
              Source
              Language