ulikoehler/UliEngineering

View on GitHub

Showing 60 of 66 total issues

File EngineerIO.py has 423 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
A python script to normalize a wide variety of value notations
from electronics engineering.
Severity: Minor
Found in UliEngineering/EngineerIO.py - About 6 hrs to fix

    File Selection.py has 419 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python3
    # -*- coding: utf-8 -*-
    """
    Utilities for selecting and finding specific attributes in datasets
    """
    Severity: Minor
    Found in UliEngineering/SignalProcessing/Selection.py - About 6 hrs to fix

      File Filter.py has 256 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python3
      # -*- coding: utf-8 -*-
      """
      A high-level API for digital filters:
      
      
      Severity: Minor
      Found in UliEngineering/SignalProcessing/Filter.py - About 2 hrs to fix

        Function split_input has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def split_input(self, s):
                """
                Separate a string into a number, suffix and unit plus prefixes.
                Does not try to parse the numbers.
                returns None if the string could not be parsed.
        Severity: Minor
        Found in UliEngineering/EngineerIO.py - About 2 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 Date.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/env python3
        from collections import namedtuple
        from calendar import monthrange
        import numpy as np
        from datetime import datetime
        Severity: Minor
        Found in UliEngineering/Utils/Date.py - About 2 hrs to fix

          Function differential_microstrip_impedance has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def differential_microstrip_impedance(w, d, h=DielectricHeight.L4_1p6mm, t="35 μm", e_r=RelativePermittivity.FR4) -> Unit("Ω"):
              """
              Compute the impedance of a differential (edge-coupled)
              outer-layer microstrip using its width, height, the distance
              between the edges of the microstrips,
          Severity: Minor
          Found in UliEngineering/Electronics/Microstrip.py - About 1 hr to fix

            Function list_recursive has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            def list_recursive(directory, relative=False, files_only=True):
                """
                List a directory recursively, yielding each filename
                (with the filename being relative to the directory).
                
            Severity: Minor
            Found in UliEngineering/Utils/Files.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 parallel_resample has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def parallel_resample(t, y, new_samplerate, out=None, prefilter=None,
            Severity: Major
            Found in UliEngineering/SignalProcessing/Resampling.py - About 1 hr to fix

              Function serial_resample has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def serial_resample(t, y, new_samplerate, out=None, prefilter=None,
              Severity: Major
              Found in UliEngineering/SignalProcessing/Resampling.py - About 1 hr to fix

                Function __parallel_resample_worker has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def __parallel_resample_worker(torig, tnew, y, out, i, chunksize, ovp_size, prefilter, fitkind):
                Severity: Major
                Found in UliEngineering/SignalProcessing/Resampling.py - About 1 hr to fix

                  Function create_window has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def create_window(size, window_id="blackman", param=None):
                      """
                      Create a new window numpy array
                      param is only used for some windows.
                  
                  
                  Severity: Minor
                  Found in UliEngineering/SignalProcessing/Window.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 split_unit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def split_unit(self, s):
                          """
                          Split a string into (remainder, unit).
                          Only units in the units set are recognized
                          unit may be '' if no unit is recognized
                  Severity: Minor
                  Found in UliEngineering/EngineerIO.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 fft_cut_dc_artifacts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def fft_cut_dc_artifacts(fft, return_idx=False):
                      """
                      If an FFT contains DC artifacts, i.e. a large value in the first FFT samples,
                      this function can be used to remove this area from the FFT value set.
                      This function cuts every value up to (but not including the) first local minimum.
                  Severity: Minor
                  Found in UliEngineering/SignalProcessing/FFT.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 _generate_wave has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def _generate_wave(genfn, frequency, samplerate, amplitude=1., length=1., phaseshift=0., timedelay=0., offset=0.):
                  Severity: Major
                  Found in UliEngineering/SignalProcessing/Simulation.py - About 1 hr to fix

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

                    def parallel_fft_reduce(chunkgen, samplerate, fftsize, removeDC=False, window="blackman", reducer=sum_reducer, normalize=True, executor=None):
                    Severity: Major
                    Found in UliEngineering/SignalProcessing/FFT.py - About 1 hr to fix

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

                      def serial_fft_reduce(chunkgen, samplerate, fftsize, removeDC=False, window="blackman", reducer=sum_reducer, normalize=True, window_param=None):
                      Severity: Major
                      Found in UliEngineering/SignalProcessing/FFT.py - About 1 hr to fix

                        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 __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 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 normalize_numeric_safe has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def normalize_numeric_safe(self, arg):
                                """
                                Normalize each element of an iterable and retrieve only the numeric value
                                (the unit is ignored). Works on iterables and string-likes.
                        
                        
                        Severity: Minor
                        Found in UliEngineering/EngineerIO.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

                        Severity
                        Category
                        Status
                        Source
                        Language