Toollabs/video2commons

View on GitHub
video2commons/backend/encode/transcodejob.py

Summary

Maintainability
F
4 days
Test Coverage

Function run_shell_exec has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    def run_shell_exec(self, cmd, track=True):
        """
        Run the shell exec command.

        @param cmd String Command to be run
Severity: Minor
Found in video2commons/backend/encode/transcodejob.py - About 5 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

File transcodejob.py has 350 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/python
# -*- coding: UTF-8 -*-
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General License as published by
Severity: Minor
Found in video2commons/backend/encode/transcodejob.py - About 4 hrs to fix

    Cyclomatic complexity is too high in method run. (18)
    Open

            self.errorcallback(error)
    
        def run(self):
            """
            Run the transcode request.

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method ffmpeg_encode. (17)
    Open

                        os.unlink(log_path)
    
        def ffmpeg_encode(self, options, p=0):
            """
            Utility helper for ffmpeg and ffmpeg2theora mapping.

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method ffmpeg_add_webm_video_options. (17)
    Open

            return cmd
    
        def ffmpeg_add_webm_video_options(self, options, p):
            """
            Add ffmpeg shell options for webm.

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method run_shell_exec. (12)
    Open

            return cmd
    
        def run_shell_exec(self, cmd, track=True):
            """
            Run the shell exec command.

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function run has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self):
            """
            Run the transcode request.
    
            @return boolean success
    Severity: Minor
    Found in video2commons/backend/encode/transcodejob.py - About 2 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

    Function ffmpeg_add_webm_video_options has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def ffmpeg_add_webm_video_options(self, options, p):
            """
            Add ffmpeg shell options for webm.
    
            @param options
    Severity: Minor
    Found in video2commons/backend/encode/transcodejob.py - About 2 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

    Function ffmpeg_encode has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def ffmpeg_encode(self, options, p=0):
            """
            Utility helper for ffmpeg and ffmpeg2theora mapping.
    
            @param options array
    Severity: Minor
    Found in video2commons/backend/encode/transcodejob.py - About 2 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

    Cyclomatic complexity is too high in method ffmpeg_add_audio_options. (8)
    Open

            return cmd
    
        def ffmpeg_add_audio_options(self, options, p):
            """
            Add ffmpeg shell options for audio.

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method ffmpeg_add_theora_video_options. (7)
    Open

            return cmd
    
        def ffmpeg_add_theora_video_options(self, options, p):
            """
            Add ffmpeg shell options for ogg.

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in class WebVideoTranscodeJob. (7)
    Open

    
    
    class WebVideoTranscodeJob(object):
        """Job class."""
    
    

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function ffmpeg_add_audio_options has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def ffmpeg_add_audio_options(self, options, p):
            """
            Add ffmpeg shell options for audio.
    
            @param options array
    Severity: Minor
    Found in video2commons/backend/encode/transcodejob.py - 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

    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Minor
    Found in video2commons/backend/encode/transcodejob.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if duration_match:
                                  duration = time_to_seconds(duration_match.group(1))
                          else:
      Severity: Major
      Found in video2commons/backend/encode/transcodejob.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if position_match:
                                    position = time_to_seconds(position_match.group(1))
                                    if duration and position:
                                        newpercentage = min(int(
                                            math.floor(100 * position / duration)
        Severity: Major
        Found in video2commons/backend/encode/transcodejob.py - About 45 mins to fix

          Function remove_ffmpeg_log_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def remove_ffmpeg_log_files(self):
                  """Remove any log files."""
                  path = self.get_target_path()
                  dir = os.path.dirname(path.rstrip(os.pathsep))
                  if os.path.isdir(dir):
          Severity: Minor
          Found in video2commons/backend/encode/transcodejob.py - 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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if 'keyframeInterval' in options:
                      cmd += ' -g ' + escape_shellarg(options['keyframeInterval'])
                      cmd += ' -keyint_min ' + \
                          escape_shellarg(options['keyframeInterval'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 1 other location - About 2 hrs to fix
          video2commons/backend/encode/transcodejob.py on lines 381..384

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if 'keyframeInterval' in options:
                      cmd += ' -g ' + escape_shellarg(options['keyframeInterval'])
                      cmd += ' -keyint_min ' + \
                          escape_shellarg(options['keyframeInterval'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 1 other location - About 2 hrs to fix
          video2commons/backend/encode/transcodejob.py on lines 337..340

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 56.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if 'videoBitrate' in options:
                      cmd += " -qmin 1 -qmax 51"
                      cmd += " -b:v " + escape_shellarg(int(options['videoBitrate']) * 1000)
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 1 other location - About 2 hrs to fix
          video2commons/backend/encode/transcodejob.py on lines 319..321

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if 'videoBitrate' in options:
                      cmd += " -qmin 1 -qmax 51"
                      cmd += " -b:v " + escape_shellarg(int(options['videoBitrate']) * 1000)
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 1 other location - About 2 hrs to fix
          video2commons/backend/encode/transcodejob.py on lines 373..375

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if not hasattr(self, 'targetEncodeFile'):
                      self.targetEncodeFile = open(self.target, 'w')
                      self.targetEncodeFile.close()
          Severity: Minor
          Found in video2commons/backend/encode/transcodejob.py and 1 other location - About 50 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 79..81

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  if not hasattr(self, 'file'):
                      self.file = open(self.source, 'r')
                      self.file.close()
          Severity: Minor
          Found in video2commons/backend/encode/transcodejob.py and 1 other location - About 50 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 91..93

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

                  if 'channels' in options:
                      cmd += " -ac " + escape_shellarg(options['channels'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 8 other locations - About 35 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 214..215
          video2commons/backend/encode/transcodejob.py on lines 278..279
          video2commons/backend/encode/transcodejob.py on lines 315..316
          video2commons/backend/encode/transcodejob.py on lines 326..328
          video2commons/backend/encode/transcodejob.py on lines 345..349
          video2commons/backend/encode/transcodejob.py on lines 389..390
          video2commons/backend/encode/transcodejob.py on lines 406..407
          video2commons/backend/encode/transcodejob.py on lines 412..413

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 33.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

                  if 'videoBitrate' in options:
                      cmd += " -b " + escape_shellarg(options['videoBitrate'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 8 other locations - About 35 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 214..215
          video2commons/backend/encode/transcodejob.py on lines 315..316
          video2commons/backend/encode/transcodejob.py on lines 326..328
          video2commons/backend/encode/transcodejob.py on lines 345..349
          video2commons/backend/encode/transcodejob.py on lines 389..390
          video2commons/backend/encode/transcodejob.py on lines 406..407
          video2commons/backend/encode/transcodejob.py on lines 412..413
          video2commons/backend/encode/transcodejob.py on lines 415..416

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 33.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

                  if 'audioQuality' in options:
                      cmd += " -aq " + escape_shellarg(options['audioQuality'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 8 other locations - About 35 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 214..215
          video2commons/backend/encode/transcodejob.py on lines 278..279
          video2commons/backend/encode/transcodejob.py on lines 315..316
          video2commons/backend/encode/transcodejob.py on lines 326..328
          video2commons/backend/encode/transcodejob.py on lines 345..349
          video2commons/backend/encode/transcodejob.py on lines 389..390
          video2commons/backend/encode/transcodejob.py on lines 412..413
          video2commons/backend/encode/transcodejob.py on lines 415..416

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 33.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

                  if 'samplerate' in options:
                      cmd += " -ar " + escape_shellarg(options['samplerate'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 8 other locations - About 35 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 214..215
          video2commons/backend/encode/transcodejob.py on lines 278..279
          video2commons/backend/encode/transcodejob.py on lines 315..316
          video2commons/backend/encode/transcodejob.py on lines 326..328
          video2commons/backend/encode/transcodejob.py on lines 345..349
          video2commons/backend/encode/transcodejob.py on lines 389..390
          video2commons/backend/encode/transcodejob.py on lines 406..407
          video2commons/backend/encode/transcodejob.py on lines 415..416

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 33.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

                  if p == 1:
                      # Make first pass faster...
                      cmd += ' -speed 4'
                  elif 'speed' in options:
                      cmd += ' -speed ' + escape_shellarg(options['speed'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 8 other locations - About 35 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 214..215
          video2commons/backend/encode/transcodejob.py on lines 278..279
          video2commons/backend/encode/transcodejob.py on lines 315..316
          video2commons/backend/encode/transcodejob.py on lines 326..328
          video2commons/backend/encode/transcodejob.py on lines 389..390
          video2commons/backend/encode/transcodejob.py on lines 406..407
          video2commons/backend/encode/transcodejob.py on lines 412..413
          video2commons/backend/encode/transcodejob.py on lines 415..416

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 33.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

                  if 'vpre' in options:
                      cmd += ' -vpre ' + escape_shellarg(options['vpre'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 8 other locations - About 35 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 278..279
          video2commons/backend/encode/transcodejob.py on lines 315..316
          video2commons/backend/encode/transcodejob.py on lines 326..328
          video2commons/backend/encode/transcodejob.py on lines 345..349
          video2commons/backend/encode/transcodejob.py on lines 389..390
          video2commons/backend/encode/transcodejob.py on lines 406..407
          video2commons/backend/encode/transcodejob.py on lines 412..413
          video2commons/backend/encode/transcodejob.py on lines 415..416

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 33.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

                  if 'framerate' in options:
                      cmd += ' -r ' + escape_shellarg(options['framerate'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 8 other locations - About 35 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 214..215
          video2commons/backend/encode/transcodejob.py on lines 278..279
          video2commons/backend/encode/transcodejob.py on lines 315..316
          video2commons/backend/encode/transcodejob.py on lines 326..328
          video2commons/backend/encode/transcodejob.py on lines 345..349
          video2commons/backend/encode/transcodejob.py on lines 406..407
          video2commons/backend/encode/transcodejob.py on lines 412..413
          video2commons/backend/encode/transcodejob.py on lines 415..416

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 33.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

                  if 'crf' in options:
                      cmd += " -crf " + escape_shellarg(options['crf'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 8 other locations - About 35 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 214..215
          video2commons/backend/encode/transcodejob.py on lines 278..279
          video2commons/backend/encode/transcodejob.py on lines 326..328
          video2commons/backend/encode/transcodejob.py on lines 345..349
          video2commons/backend/encode/transcodejob.py on lines 389..390
          video2commons/backend/encode/transcodejob.py on lines 406..407
          video2commons/backend/encode/transcodejob.py on lines 412..413
          video2commons/backend/encode/transcodejob.py on lines 415..416

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 33.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

                      if 'tileColumns' in options:
                          cmd += ' -tile-columns ' + \
                              escape_shellarg(options['tileColumns'])
          Severity: Major
          Found in video2commons/backend/encode/transcodejob.py and 8 other locations - About 35 mins to fix
          video2commons/backend/encode/transcodejob.py on lines 214..215
          video2commons/backend/encode/transcodejob.py on lines 278..279
          video2commons/backend/encode/transcodejob.py on lines 315..316
          video2commons/backend/encode/transcodejob.py on lines 345..349
          video2commons/backend/encode/transcodejob.py on lines 389..390
          video2commons/backend/encode/transcodejob.py on lines 406..407
          video2commons/backend/encode/transcodejob.py on lines 412..413
          video2commons/backend/encode/transcodejob.py on lines 415..416

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 33.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status