QutBioacoustics/baw-workers

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

Summary

Maintainability
C
1 day
Test Coverage

Method action_summary has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

        def action_summary(results)
          base_path = Pathname.new(results[:path])
          files = results[:results]

          BawWorkers::Config.logger_worker.debug(self.name) {
Severity: Minor
Found in lib/baw-workers/harvest/action.rb - About 6 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

Method action_summary has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def action_summary(results)
          base_path = Pathname.new(results[:path])
          files = results[:results]

          BawWorkers::Config.logger_worker.debug(self.name) {
Severity: Minor
Found in lib/baw-workers/harvest/action.rb - About 1 hr to fix

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

            def action_gather_and_process(to_do_path, is_real_run, copy_on_success = false)
              gather_files = action_gather_files
              file_hashes = gather_files.run(to_do_path)
    
              results = {path: to_do_path, results: []}
    Severity: Minor
    Found in lib/baw-workers/harvest/action.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

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

            def action_run(harvest_params, is_real_run)
    
              BawWorkers::Config.logger_worker.info(self.name) {
                "Started harvest #{is_real_run ? 'real run' : 'dry run' } using '#{harvest_params}'."
              }
    Severity: Minor
    Found in lib/baw-workers/harvest/action.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