Toollabs/video2commons

View on GitHub

Showing 44 of 99 total issues

File video2commons.js has 821 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* globals nunjucks: false, io: false, Qs: false */
( function ( $ ) {
    'use strict';

    var config = window.config,
Severity: Major
Found in video2commons/frontend/static/video2commons.js - About 1 day to fix

    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 api.py has 381 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python3
    # -*- coding: UTF-8 -*-
    #
    # Copyright (C) 2015-2016 Zhuyifei1999
    #
    Severity: Minor
    Found in video2commons/frontend/api.py - About 5 hrs to fix

      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

        Function processInput has 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                processInput: function ( button ) {
                    var resolved = $.when(); // A resolved jQuery promise
        
                    var deferred;
                    switch ( newTaskData.step ) {
        Severity: Major
        Found in video2commons/frontend/static/video2commons.js - About 4 hrs to fix

          Function main has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

          def main(
              self, url, ie_key, subtitles, filename, filedesc,
              downloadkey, convertkey, username, oauth
          ):
              """Main worker code."""
          Severity: Minor
          Found in video2commons/backend/worker.py - 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

          Function download has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

          def download(
              url, ie_key, formats, subtitles, outputdir,
              statuscallback=None, errorcallback=None
          ):
              """Download a video from url to outputdir."""
          Severity: Minor
          Found in video2commons/backend/download/__init__.py - 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

          Function subtitles has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          def subtitles(
              subtitles, wikifilename, username,
              statuscallback=None, errorcallback=None
          ):
              """Convert and upload subtitles to corresponding TimedText pages."""
          Severity: Minor
          Found in video2commons/backend/subtitles/__init__.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 _status has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          def _status(id):
              title = get_title_from_task(id)
              if not title:
                  # task has been forgotten -- results should have been expired
                  return None
          Severity: Minor
          Found in video2commons/frontend/api.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 updateTask has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  updateTask: function ( val ) {
                      var table = $( '#tasktable > tbody' );
          
                      var id = 'task-' + val.id,
                          $row = $( '#' + id );
          Severity: Major
          Found in video2commons/frontend/static/video2commons.js - About 2 hrs to fix

            Function getbestkey has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            def getbestkey(info, targettype):
                """Find the bext convert key to use."""
                # Asserts
                assert info, 'The file format could not be recognized'
                assert targettype, 'The target format is invalid.'
            Severity: Minor
            Found in video2commons/backend/encode/__init__.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 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 setupAddTaskDialog has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    setupAddTaskDialog: function () {
                        switch ( newTaskData.step ) {
                            case 'source':
                                $addTaskDialog.find( '.modal-body' )
                                    .html( nunjucksEnv.render( 'sourceForm.html' ) );
            Severity: Major
            Found in video2commons/frontend/static/video2commons.js - About 2 hrs to fix

              Function initUpload has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      initUpload: function () {
                          var deferred;
              
                          window.jqXHR = $addTaskDialog.find( '#fileupload' ).fileupload( {
                              dataType: 'json',
              Severity: Major
              Found in video2commons/frontend/static/video2commons.js - About 2 hrs to fix

                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

                File urlextract.py has 259 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                #!/usr/bin/env python3
                # -*- coding: UTF-8 -*-
                #
                # Copyright (C) 2015-2016 Zhuyifei1999
                #
                Severity: Minor
                Found in video2commons/frontend/urlextract.py - About 2 hrs to fix

                  Function setupTaskRow has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          setupTaskRow: function ( $row, id, status ) {
                              switch ( status ) {
                                  case 'progress':
                                      /* eslint-disable indent */
                                      $row.append( $( '<td />' )
                  Severity: Major
                  Found in video2commons/frontend/static/video2commons.js - About 2 hrs to fix

                    Function _source has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _source(url, ie_key, title, info):
                        if info['id']:
                            if ie_key == 'Youtube':
                                return '{{From YouTube|1=%(id)s|2=%(title)s}}' % \
                                    {'id': info['id'], 'title': escape_wikitext(title)}
                    Severity: Minor
                    Found in video2commons/frontend/urlextract.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 reactivatePrevNextButtons has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            reactivatePrevNextButtons: function () {
                                $addTaskDialog.find( '#dialog-spinner' )
                                    .hide();
                                switch ( newTaskData.step ) {
                                    case 'source':
                    Severity: Minor
                    Found in video2commons/frontend/static/video2commons.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language