ulikoehler/UliEngineering

View on GitHub

Showing 64 of 64 total issues

File EngineerIO.py has 422 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

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              if len(coords.shape) != 2 or coords.shape[1] != 2:
                  raise ValueError("Wrong shape for polygon area input (expect (n,2)): {}".format(
                      coords.shape))
          Severity: Major
          Found in UliEngineering/Math/Geometry/Polygon.py and 2 other locations - About 2 hrs to fix
          UliEngineering/Math/Coordinates.py on lines 22..24
          UliEngineering/Math/Geometry/Polygon.py on lines 23..25

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              if len(coords.shape) != 2 or coords.shape[1] != 2:
                  raise ValueError("Wrong shape for polygon lines input (expect (n,2)): {}".format(
                      coords.shape))
          Severity: Major
          Found in UliEngineering/Math/Geometry/Polygon.py and 2 other locations - About 2 hrs to fix
          UliEngineering/Math/Coordinates.py on lines 22..24
          UliEngineering/Math/Geometry/Polygon.py on lines 41..43

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

                  if len(points.shape) != 2 or points.shape[1] != 2:
                      raise ValueError("Points must be a (n,2), array but it has shape {}".format(
                          points.shape))
          Severity: Major
          Found in UliEngineering/Math/Coordinates.py and 2 other locations - About 2 hrs to fix
          UliEngineering/Math/Geometry/Polygon.py on lines 23..25
          UliEngineering/Math/Geometry/Polygon.py on lines 41..43

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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