ihavalyova/DiAtomic

View on GitHub
diatomic/hamiltonian.py

Summary

Maintainability
C
1 day
Test Coverage

File hamiltonian.py has 793 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import os
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt

Severity: Major
Found in diatomic/hamiltonian.py - About 1 day to fix

    Function solve has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def solve(self, ops, ypar=None, energy_range_index=None, energy_range_value=None):
            """A general function which solves the coupled system of Shcrodinger equations
    
            Args:
                energy_range_index (tuple, optional): Specifies a subset of
    Severity: Minor
    Found in diatomic/hamiltonian.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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, objs, pair_states, label, model='pointwise', rotc=0.0,
    Severity: Major
    Found in diatomic/hamiltonian.py - About 1 hr to fix

      Function extract_terms_in_range has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def extract_terms_in_range(self, uenergy=None, lenergy=None, usymm=None,
      Severity: Major
      Found in diatomic/hamiltonian.py - About 1 hr to fix

        Function plot_radial_functions has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def plot_radial_functions(self, ops, show=False, fname=None, subplots=None,
        Severity: Major
        Found in diatomic/hamiltonian.py - About 1 hr to fix

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

              def plot_levels_hist(self, data=None, show=False, fname=None,
          Severity: Major
          Found in diatomic/hamiltonian.py - About 50 mins to fix

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

                def _five_diagonal_matrix(self, a, b, c, k1=0, k2=1, k3=2):
            Severity: Major
            Found in diatomic/hamiltonian.py - About 50 mins to fix

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

                  def _arange_levels(self, jrotn, par, iso, evalues, evecs, shift_enr=[0.0]):
              Severity: Minor
              Found in diatomic/hamiltonian.py - About 45 mins to fix

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

                    def plot_eigenfunctions(self, nlevels, show=False, fname=None,
                Severity: Minor
                Found in diatomic/hamiltonian.py - About 45 mins to fix

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

                      def plot_hamiltonian_colormesh(self, rows=None, cols=None, show=False,
                  Severity: Minor
                  Found in diatomic/hamiltonian.py - About 45 mins to fix

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

                        def __init__(self, objs, eig_decomp='lapack', lapack_driver='evr',
                    Severity: Minor
                    Found in diatomic/hamiltonian.py - About 35 mins to fix

                      Function __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __init__(self, objs, eig_decomp='lapack', lapack_driver='evr',
                                       arpack_options=('LM', 6, None), is_weighted=False):
                      
                              """Construct the Hamiltonian object.
                      
                      
                      Severity: Minor
                      Found in diatomic/hamiltonian.py - About 25 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