QutBioacoustics/baw-audio-tools

View on GitHub
lib/baw-audio-tools/run_external_program.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method execute has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def execute(command, raise_exit_error = true)

      if OS.windows?
        #if command.include? '&& move'
        # if windows and contains a 'move' command, need to ensure relative path has '\' separators
Severity: Minor
Found in lib/baw-audio-tools/run_external_program.rb - About 1 hr to fix

    Method read_to_stream has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_to_stream(stdout, stderr, output, error, options)
          tick = options[:tick]
          buffer_size = options[:buffer_size]
          exceptions = []
          is_windows = OS.windows?
    Severity: Minor
    Found in lib/baw-audio-tools/run_external_program.rb - 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

    Method execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute(command, raise_exit_error = true)
    
          if OS.windows?
            #if command.include? '&& move'
            # if windows and contains a 'move' command, need to ensure relative path has '\' separators
    Severity: Minor
    Found in lib/baw-audio-tools/run_external_program.rb - 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

    Method read_to_stream has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def read_to_stream(stdout, stderr, output, error, options)
    Severity: Minor
    Found in lib/baw-audio-tools/run_external_program.rb - About 35 mins to fix

      There are no issues that match your filters.

      Category
      Status