bjmorgan/vasppy

View on GitHub
vasppy/procar.py

Summary

Maintainability
D
1 day
Test Coverage
D
66%

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

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

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

            There are no issues that match your filters.

            Category
            Status