QutBioacoustics/baw-workers

View on GitHub
lib/baw-workers/harvest/gather_files.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method process has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def process(path, top_dir, recurse = true)
        dirs = []
        results = []

        path = File.expand_path(path)
Severity: Minor
Found in lib/baw-workers/harvest/gather_files.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 get_folder_settings has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def get_folder_settings(file)
        unless File.file?(file)
          @logger.debug(@class_name) { "Harvest directory config file was not found '#{file}'." }
          return {}
        end
Severity: Minor
Found in lib/baw-workers/harvest/gather_files.rb - About 1 hr to fix

    Method process has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def process(path, top_dir, recurse = true)
            dirs = []
            results = []
    
            path = File.expand_path(path)
    Severity: Minor
    Found in lib/baw-workers/harvest/gather_files.rb - About 1 hr to fix

      Method run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def run(input, recurse = true)
              results = []
      
              @logger.info(@class_name) { 'Gathering files.' }
      
      
      Severity: Minor
      Found in lib/baw-workers/harvest/gather_files.rb - 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

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

            def get_folder_settings(file)
              unless File.file?(file)
                @logger.debug(@class_name) { "Harvest directory config file was not found '#{file}'." }
                return {}
              end
      Severity: Minor
      Found in lib/baw-workers/harvest/gather_files.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 file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def file(path, top_dir, dir_settings = {})
              unless File.file?(path)
                msg = "'#{path}' is not a file."
                @logger.error(@class_name) { msg }
                fail ArgumentError, msg
      Severity: Minor
      Found in lib/baw-workers/harvest/gather_files.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

      There are no issues that match your filters.

      Category
      Status