ulikoehler/UliEngineering

View on GitHub

Showing 64 of 64 total issues

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

def ptx_temperature(r0, r, standard=ptxITS90, poly=None) -> Unit("°C"):
    """
    Compute the PTx temperature at a given temperature.

    Accepts an additive correction polynomial that is applied to the resistance.
Severity: Minor
Found in UliEngineering/Physics/RTD.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 hash_directory has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def hash_directory(directory, recursive=True, hash_type=hashlib.sha256, binary=False, relative_paths=True, buffer_size=65536, concurrency=os.cpu_count()):
    """
    List all files in a directory (recursively, depending on options)
    and compute the hash of each file.
    
Severity: Minor
Found in UliEngineering/Filesystem/Hash.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 auto_strptime has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def auto_strptime(s):
    """
    Parses a datetime in a number of formats,
    automatically recognizing which format is correct.

Severity: Minor
Found in UliEngineering/SignalProcessing/DateTime.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 __getitem__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __getitem__(self, arg):
        """
        Select a frequency range:
        fft[1.0:100.0] selects the 1.0 ... 100.0 Hz frequency range
        fft[1.0:] selects everything from 1.0 Hz to the max frequency
Severity: Minor
Found in UliEngineering/SignalProcessing/FFT.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 simple_fft_reduce has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def simple_fft_reduce(fn, arr, samplerate, fftsize, shiftsize=None, nthreads=4, **kwargs):
Severity: Major
Found in UliEngineering/SignalProcessing/FFT.py - About 50 mins to fix

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

    def hash_directory(directory, recursive=True, hash_type=hashlib.sha256, binary=False, relative_paths=True, buffer_size=65536, concurrency=os.cpu_count()):
    Severity: Major
    Found in UliEngineering/Filesystem/Hash.py - About 50 mins to fix

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

      def extract_numeric_column(flo, isline=__standard_isline, postproc=functoolz.identity,
      Severity: Major
      Found in UliEngineering/Utils/Files.py - About 50 mins to fix

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

        def value_range_over_temperature(nominal, coefficient="100ppm", tolerance="0 %", tmin="-40 °C", tmax="85 °C", tref="25 °C", significant_digits=4):
        Severity: Major
        Found in UliEngineering/Electronics/TemperatureCoefficient.py - About 50 mins to fix

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

          def aggregate(gen):
              """
              Takes any iterable and aggregates subsequent values
              yielded by the iterable into a single value with a counter.
          
          
          Severity: Minor
          Found in UliEngineering/SignalProcessing/Utils.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 numpy_resize_insert has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def numpy_resize_insert(arr, val, index, growth_factor=1.5, min_growth=1000, max_growth=1000000):
          Severity: Minor
          Found in UliEngineering/Utils/NumPy.py - About 45 mins to fix

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

            def select_by_datetime(timestamps, time, factor=1.0, around=None, ofs=0.0, side="left"):
            Severity: Minor
            Found in UliEngineering/SignalProcessing/Selection.py - About 45 mins to fix

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

              def normalize_temperature(t, default_unit="°C") -> Unit("K"):
                  """
                  Normalize a temperature to kelvin.
                  If it is a number or it has no unit, assume it is a default unit
                  Else, evaluate the unit(K, °C, °F, C, F)
              Severity: Minor
              Found in UliEngineering/Physics/Temperature.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 summing_amplifier_noninv has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def summing_amplifier_noninv(v1, v2, r1, r2, rfb1, rfb2) -> Unit("V"):
              Severity: Minor
              Found in UliEngineering/Electronics/OpAmp.py - About 45 mins to fix

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

                def _check_filter_type(btype, freqs):
                    if btype == "lowpass" or btype == "highpass":
                        if not isinstance(freqs, numbers.Number):
                            raise ValueError("Pass-type {0} requires a single critical frequency, not {1}".format(btype, freqs))
                    elif btype == "bandpass" or btype == "bandstop":
                Severity: Minor
                Found in UliEngineering/SignalProcessing/Filter.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 __getitem__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __getitem__(self, key):
                        """
                        Get:
                            - A numpy linrange slice
                        """
                Severity: Minor
                Found in UliEngineering/SignalProcessing/Utils.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 __hysteresis_threshold_voltages has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def __hysteresis_threshold_voltages(r1, r2, rh, vcc, fn):
                Severity: Minor
                Found in UliEngineering/Electronics/Hysteresis.py - About 35 mins to fix

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

                  def __fft_reduce_worker(chunkgen, i, window, fftsize, removeDC):
                  Severity: Minor
                  Found in UliEngineering/SignalProcessing/FFT.py - About 35 mins to fix

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

                    def overlapping_chunks(arr, chunksize, shiftsize, func=None, copy=False):
                    Severity: Minor
                    Found in UliEngineering/SignalProcessing/Chunks.py - About 35 mins to fix

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

                          def find_sorted_extrema(x, y, comparator=np.greater, order=1, mode='clip'):
                      Severity: Minor
                      Found in UliEngineering/SignalProcessing/Selection.py - About 35 mins to fix

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

                            def __init__(self, start, stop, n, endpoint=True, dtype=float):
                        Severity: Minor
                        Found in UliEngineering/SignalProcessing/Utils.py - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language