openva/rs-video-processor

View on GitHub

Showing 61 of 61 total issues

File resolve_chyrons.php has 403 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

require_once __DIR__ . '/../includes/settings.inc.php';
require_once __DIR__ . '/../includes/functions.inc.php';

Severity: Minor
Found in bin/resolve_chyrons.php - About 5 hrs to fix

    Consider simplifying this complex logical expression.
    Open

            if (
                (substr($chyron['raw_text'], 0, 2) == 's8')
                ||
                (substr($chyron['raw_text'], 0, 2) == '58')
                ||
    Severity: Critical
    Found in bin/resolve_chyrons.php - About 2 hrs to fix

      File detect_faces.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      error_reporting(E_ALL);
      ini_set('display_errors', 1);
      
      
      Severity: Minor
      Found in bin/detect_faces.php - About 2 hrs to fix

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

        def sample_chyrons(directory_path):
            # Select a bunch of random screenshots
            screenshots = glob.glob(os.path.join(directory_path, '*.jpg'))
            random_screenshots = random.sample(screenshots, 200)
        
        
        Severity: Minor
        Found in bin/rs_video.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

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

                if (
                    (substr($chyron['raw_text'], 0, 2) == 's8')
                    ||
                    (substr($chyron['raw_text'], 0, 2) == '58')
                    ||
        Severity: Major
        Found in bin/resolve_chyrons.php and 2 other locations - About 55 mins to fix
        bin/resolve_chyrons.php on lines 132..142
        bin/resolve_chyrons.php on lines 142..152

        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 98.

        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 3 locations. Consider refactoring.
        Open

                } elseif (
                    (substr($chyron['raw_text'], 0, 2) == 'I ')
                    ||
                    (substr($chyron['raw_text'], 0, 2) == '| ')
                    ||
        Severity: Major
        Found in bin/resolve_chyrons.php and 2 other locations - About 55 mins to fix
        bin/resolve_chyrons.php on lines 116..152
        bin/resolve_chyrons.php on lines 132..142

        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 98.

        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 3 locations. Consider refactoring.
        Open

                } elseif (
                    (substr($chyron['raw_text'], 0, 3) == 'hjr')
                    ||
                    (substr($chyron['raw_text'], 0, 3) == 'pur')
                    ||
        Severity: Major
        Found in bin/resolve_chyrons.php and 2 other locations - About 55 mins to fix
        bin/resolve_chyrons.php on lines 116..152
        bin/resolve_chyrons.php on lines 142..152

        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 98.

        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

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 19 and the first side effect is on line 12.
        Open

        <?php
        Severity: Minor
        Found in bin/get_video.php by phpcodesniffer

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 9 and the first side effect is on line 3.
        Open

        <?php
        Severity: Minor
        Found in bin/save_metadata.php by phpcodesniffer

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 13 and the first side effect is on line 3.
        Open

        <?php
        Severity: Minor
        Found in bin/save_chyrons.php by phpcodesniffer

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 13 and the first side effect is on line 3.
        Open

        <?php
        Severity: Minor
        Found in bin/resolve_chyrons.php by phpcodesniffer

        A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 14 and the first side effect is on line 3.
        Open

        <?php
        Severity: Minor
        Found in bin/detect_faces.php by phpcodesniffer

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

        def extract_frames(video_path, output_folder):
            # Open the video file
            cap = cv2.VideoCapture(video_path)
            
            if not cap.isOpened():
        Severity: Minor
        Found in bin/rs_video.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

        Line exceeds 120 characters; contains 134 characters
        Open

            $s3_key = $video->chamber . '/' . 'committee/' . urlencode(strtolower($video->committee_shortname)) . '/' . $video->date . '.mp4';
        Severity: Minor
        Found in bin/get_video.php by phpcodesniffer

        Line exceeds 120 characters; contains 123 characters
        Open

                    <meta http-equiv=Refresh CONTENT="60; URL=http://www.richmondsunlight.com/utilities/detect_faces.php?op=train">
        Severity: Minor
        Found in bin/detect_faces.php by phpcodesniffer

        Line exceeds 120 characters; contains 123 characters
        Open

            $file['capture_directory'] = '/video/' . $metadata->chamber . '/' . $committee_shortname . '/' . $metadata->date . '/';
        Severity: Minor
        Found in bin/save_metadata.php by phpcodesniffer

        Line exceeds 120 characters; contains 124 characters
        Open

                    <meta http-equiv=Refresh CONTENT="60; URL=http://www.richmondsunlight.com/utilities/detect_faces.php?op=detect">
        Severity: Minor
        Found in bin/detect_faces.php by phpcodesniffer

        Expected 1 space after closing brace; newline found
        Open

                }
        Severity: Minor
        Found in bin/save_chyrons.php by phpcodesniffer

        Expected 1 space after closing brace; newline found
        Open

        }
        Severity: Minor
        Found in bin/detect_faces.php by phpcodesniffer

        Expected 0 spaces after opening bracket; newline found
        Open

                if (
        Severity: Minor
        Found in bin/resolve_chyrons.php by phpcodesniffer
        Severity
        Category
        Status
        Source
        Language