QutBioacousticsResearchGroup/bioacoustic-workbench

View on GitHub
lib/modules/file_cacher.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method create_audio_segment has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.create_audio_segment(modify_parameters = {})
    # first check if a cached audio file matches the request
    target_file = Cache::cached_audio_file modify_parameters
    target_existing_paths = Cache::existing_paths(Cache::cached_audio_storage_paths,target_file)
Severity: Minor
Found in lib/modules/file_cacher.rb - About 1 hr to fix

    Method generate_spectrogram has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.generate_spectrogram(modify_parameters = {})
    
        # first check if a cached spectrogram matches the request
    
        target_file = Cache::cached_spectrogram_file modify_parameters
    Severity: Minor
    Found in lib/modules/file_cacher.rb - 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

    Method create_audio_segment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.create_audio_segment(modify_parameters = {})
        # first check if a cached audio file matches the request
        target_file = Cache::cached_audio_file modify_parameters
        target_existing_paths = Cache::existing_paths(Cache::cached_audio_storage_paths,target_file)
    
    Severity: Minor
    Found in lib/modules/file_cacher.rb - 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

    Method check_file_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.check_file_hash(file_path, audio_recording)
        # ensure this audio recording needs to be checked
        return if audio_recording.status != :to_check
    
        # type of hash is at start of hash_to_compare, split using two colons
    Severity: Minor
    Found in lib/modules/file_cacher.rb - 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