rdavid/transcode

View on GitHub

Showing 5 of 5 total issues

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

  def humanize(sec)
    return '' if sec.nil?
    return Timer.less_sec if sec < 1

    DIC.map do |cnt, nms, nm1|
Severity: Minor
Found in lib/transcode/utils.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 add has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def add(file, res, aud = 0, sub = 0, tit = 0)
Severity: Minor
Found in lib/transcode/reporter.rb - About 35 mins to fix

    Method do has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def do # rubocop:disable Metrics/AbcSize
          if @cfg.mp3?
            @cfg.files.each { |f| @rep.add(f, @cfg.act? ? run(mp3_cmd(f)) : true) }
          elsif @cfg.sca?
            @cfg.files.each { |f| @rep.add(f, run(scn_cmd(f))) }
    Severity: Minor
    Found in lib/transcode/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 validate_dir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_dir(dir, isw)
          raise "#{dir}: No such directory." unless File.directory?(dir)
    
          err = isw ? File.writable?(dir) : File.readable?(dir)
          raise "#{out}: Permission denied." unless err
    Severity: Minor
    Found in lib/transcode/configurator.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 m4v_cmd has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def m4v_cmd(file, aud, sub, tit)
          c = 'transcode-video --m4v --no-log --preset veryslow'\
              " --output #{@cfg.out}"
          unless tit == '0'
            c += "/#{File.basename(file.shellescape)}-#{tit}.m4v"
    Severity: Minor
    Found in lib/transcode/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