thcolin/scene-release-parser

View on GitHub

Showing 31 of 37 total issues

File Release.php has 756 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

  namespace thcolin\SceneReleaseParser;

  use Mhor\MediaInfo\MediaInfo;
Severity: Major
Found in src/Release.php - About 1 day to fix

    Function execute has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output){
          $verbose = !$input -> getOption('non-verbose');
          $interactive = !$input -> getOption('non-interactive');
          $invasive = !$input -> getOption('non-invasive');
    
    
    Severity: Minor
    Found in src/Command/RenamerCommand.php - About 1 day 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 analyse has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function analyse($path, $config = []){
          if(!is_file($path)){
            throw new InvalidArgumentException("File '".$path."' not found");
          }
    
    
    Severity: Minor
    Found in src/Release.php - About 1 day 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 correct has 182 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function correct(InputInterface $input, OutputInterface $output, Release $release){
          $done = false;
    
          do{
            $output->writeln('');
    Severity: Major
    Found in src/Command/RenamerCommand.php - About 7 hrs to fix

      Release has 45 functions (exceeds 20 allowed). Consider refactoring.
      Open

        class Release{
      
          const MOVIE = 'movie';
          const TVSHOW = 'tvshow';
      
      
      Severity: Minor
      Found in src/Release.php - About 6 hrs to fix

        Method execute has 119 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function execute(InputInterface $input, OutputInterface $output){
              $verbose = !$input -> getOption('non-verbose');
              $interactive = !$input -> getOption('non-interactive');
              $invasive = !$input -> getOption('non-invasive');
        
        
        Severity: Major
        Found in src/Command/RenamerCommand.php - About 4 hrs to fix

          File RenamerCommand.php has 332 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
            namespace thcolin\SceneReleaseParser\Command;
          
            use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
          Severity: Minor
          Found in src/Command/RenamerCommand.php - About 4 hrs to fix

            Method analyse has 94 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function analyse($path, $config = []){
                  if(!is_file($path)){
                    throw new InvalidArgumentException("File '".$path."' not found");
                  }
            
            
            Severity: Major
            Found in src/Release.php - About 3 hrs to fix

              Function parseLanguage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function parseLanguage(&$title){
                    $languages = [];
              
                    foreach(self::$languageStatic as $langue => $patterns){
                      if(!is_array($patterns)){
              Severity: Minor
              Found in src/Release.php - 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 correct has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function correct(InputInterface $input, OutputInterface $output, Release $release){
                    $done = false;
              
                    do{
                      $output->writeln('');
              Severity: Minor
              Found in src/Command/RenamerCommand.php - 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 __construct has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct($name, $strict = true, $defaults = []){
                    foreach($defaults as $key => $default){
                      $const = $key.'Static';
              
                      if(property_exists(get_class(), $const) && !in_array($default, array_keys(self::$$const))){
              Severity: Minor
              Found in src/Release.php - About 1 hr to fix

                Function guessResolution has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function guessResolution(){
                      if($this -> resolution){
                        return $this -> resolution;
                      } else if($this->getSource() == self::SOURCE_BLURAY || $this->getSource() == self::SOURCE_BDSCR){
                        return self::RESOLUTION_1080P;
                Severity: Minor
                Found in src/Release.php - 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 parseAttribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function parseAttribute(&$title, $attribute){
                      if(!in_array($attribute, [self::SOURCE, self::ENCODING, self::RESOLUTION, self::DUB])){
                        throw new InvalidArgumentException();
                      }
                
                
                Severity: Minor
                Found in src/Release.php - About 55 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

                Function parseFlags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function parseFlags(&$title){
                      $flags = [];
                
                      foreach(self::$flagsStatic as $key => $patterns){
                        if(!is_array($patterns)){
                Severity: Minor
                Found in src/Release.php - 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

                Function __toString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __toString(){
                      $arrays = [];
                      foreach([
                        $this -> getTitle(),
                        $this -> getYear(),
                Severity: Minor
                Found in src/Release.php - 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

                Avoid too many return statements within this method.
                Open

                                return null;
                Severity: Major
                Found in src/Command/RenamerCommand.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                return $answer;
                  Severity: Major
                  Found in src/Command/RenamerCommand.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                  return $answer;
                    Severity: Major
                    Found in src/Command/RenamerCommand.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return null;
                      Severity: Major
                      Found in src/Command/RenamerCommand.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                      return $answer;
                        Severity: Major
                        Found in src/Command/RenamerCommand.php - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language