bikeath1337/streamio-ffmpeg

View on GitHub

Showing 14 of 14 total issues

Method initialize has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(path)
      @path = path

      if remote?
        @head = head
Severity: Minor
Found in lib/ffmpeg/movie.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

Class EncodingOptions has 38 methods (exceeds 20 allowed). Consider refactoring.
Open

  class EncodingOptions < Hash
    def initialize(options = {})
      merge!(options)
    end

Severity: Minor
Found in lib/ffmpeg/encoding_options.rb - About 5 hrs to fix

    Method transcode_movie has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def transcode_movie
          FFMPEG.logger.info("Running transcoding...\n#{command}\n")
          @output = ""
    
          Open3.popen3(*command) do |_stdin, _stdout, stderr, wait_thr|
    Severity: Minor
    Found in lib/ffmpeg/transcoder.rb - About 3 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 initialize has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def initialize(path)
          @path = path
    
          if remote?
            @head = head
    Severity: Major
    Found in lib/ffmpeg/movie.rb - About 3 hrs to fix

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

          def apply_transcoder_options
             # if true runs #validate_output_file
            @transcoder_options[:validate] = @transcoder_options.fetch(:validate) { true }
      
            return if @movie.nil? || @movie.calculated_aspect_ratio.nil?
      Severity: Minor
      Found in lib/ffmpeg/transcoder.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 screenshot_seek_time has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def screenshot_seek_time(options)
            # Returns any seek_time for the screenshot and removes it from the options
            # such that the seek time can be moved to an input option for improved FFMPEG performance
            if options.is_a?(Array)
              seek_time_idx = options.find_index('-seek_time') unless options.find_index('-screenshot').nil?
      Severity: Minor
      Found in lib/ffmpeg/transcoder.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 transcode_movie has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def transcode_movie
            FFMPEG.logger.info("Running transcoding...\n#{command}\n")
            @output = ""
      
            Open3.popen3(*command) do |_stdin, _stdout, stderr, wait_thr|
      Severity: Minor
      Found in lib/ffmpeg/transcoder.rb - About 1 hr to fix

        Method head has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def head(location=@path, limit=FFMPEG.max_http_redirect_attempts)
              url = URI(location)
              return unless url.path
        
              http = Net::HTTP.new(url.host, url.port)
        Severity: Minor
        Found in lib/ffmpeg/movie.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 validate_output_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate_output_file(&block)
              @errors << "no output file created" unless File.exist?(@output_file)
              @errors << "encoded file is invalid" if encoded.nil? || !encoded.valid?
        
              if encoding_succeeded?
        Severity: Minor
        Found in lib/ffmpeg/transcoder.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 each_with_timeout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def each_with_timeout(pid, seconds, sep_string=$/)
            last_update = Time.now
        
            current_thread = Thread.current
            check_update_thread = Thread.new do
        Severity: Minor
        Found in lib/ffmpeg/io_monkey.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 to_a has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def to_a
              params = []
        
              # codecs should go before the presets so that the files will be matched successfully
              # all other parameters go after so that we can override whatever is in the preset
        Severity: Minor
        Found in lib/ffmpeg/encoding_options.rb - About 35 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 screenshot_to_transcoder_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def screenshot_to_transcoder_options(seek_time, transcoder_options)
              return if seek_time.to_s == ''
        
              input_options = transcoder_options[:input_options] || []
              # remove ss from input options because we're overriding from seek_time
        Severity: Minor
        Found in lib/ffmpeg/transcoder.rb - About 35 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 calculate_aspect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def calculate_aspect(ratio)
              return nil unless ratio
              w, h = ratio.split(':')
              return nil if w == '0' || h == '0'
              @rotation.nil? || (@rotation == 180) ? (w.to_f / h.to_f) : (h.to_f / w.to_f)
        Severity: Minor
        Found in lib/ffmpeg/movie.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(input, output_file, options = EncodingOptions.new, transcoder_options = {})
              if input.is_a?(FFMPEG::Movie)
                @movie = input
                @input = input.path
              end
        Severity: Minor
        Found in lib/ffmpeg/transcoder.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

        Severity
        Category
        Status
        Source
        Language