bjmorgan/vasppy

View on GitHub
vasppy/doscar.py

Summary

Maintainability
D
1 day
Test Coverage
F
13%

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

    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

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

        There are no issues that match your filters.

        Category
        Status