Noosfero/noosfero

View on GitHub
plugins/html5_video/lib/video_processor/converter.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

      def convert_to_tiny(format)
        logger.info "Generating tiny #{format} for [Video #{@video_id}]"
        audio_stream = info[:streams].find { |s| s[:type] == "audio" }
        abrate = audio_stream.nil? ? 64 : audio_stream[:bitrate] || 64
        abrate = 64 if abrate > 64
Severity: Minor
Found in plugins/html5_video/lib/video_processor/converter.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 convert_to_nice has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def convert_to_nice(format)
        logger.info "Generating nice #{format} for [Video #{@video_id}]"
        if video.is_toobig
          # Max video dimension for each Aspect Ratio:
          #  * 576x432 for 4:3
Severity: Minor
Found in plugins/html5_video/lib/video_processor/converter.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