biurad/php-monorepo

View on GitHub

Showing 10 of 10 total issues

Method work has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function work(Monorepo $repo, InputInterface $input, SymfonyStyle $output): int
    {
        [$mainRepo, $branches] = [$repo->getRepository(), $input->getOption('branch')];
        $currentBranch = $mainRepo->getBranch()->getName();

Severity: Major
Found in src/Worker/SplitCommitsWorker.php - About 4 hrs to fix

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

        public function resolveRepository(OutputInterface $output, callable $resolver, callable $checker = null): int
        {
            $result = 0;
    
            foreach ($this->repositories as [$url, $remote, $path, $merge]) {
    Severity: Minor
    Found in src/Monorepo.php - 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

    Method work has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function work(Monorepo $repo, InputInterface $input, SymfonyStyle $output): int
        {
            $mainRepo = $repo->getRepository();
            $output->writeln('<info>Checking git filter-repo command existence...</info>');
    
    
    Severity: Major
    Found in src/Worker/MergeRepoWorker.php - About 2 hrs to fix

      Method __construct has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct(string $rootPath, string $cachePath = null, bool $reclone)
          {
              if (!\file_exists($configFile = ($this->config['path'] = $rootPath).'/.monorepo')) {
                  throw new \RuntimeException(\sprintf('Config file "%s" does not exist.', $configFile));
              }
      Severity: Major
      Found in src/Config.php - About 2 hrs to fix

        Method resolveRepository has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function resolveRepository(OutputInterface $output, callable $resolver, callable $checker = null): int
            {
                $result = 0;
        
                foreach ($this->repositories as [$url, $remote, $path, $merge]) {
        Severity: Minor
        Found in src/Monorepo.php - About 1 hr to fix

          Function initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function initialize(InputInterface $input, OutputInterface $output): void
              {
                  $repositories = [];
                  $this->output = new SymfonyStyle($input, $output);
                  $config = new Config(\rtrim($input->getOption('path') ?? $this->rootPath, '\/'), $input->getOption('cache'), $input->getOption('clean'));
          Severity: Minor
          Found in src/WorkflowCommand.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 initialize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function initialize(InputInterface $input, OutputInterface $output): void
              {
                  $repositories = [];
                  $this->output = new SymfonyStyle($input, $output);
                  $config = new Config(\rtrim($input->getOption('path') ?? $this->rootPath, '\/'), $input->getOption('cache'), $input->getOption('clean'));
          Severity: Minor
          Found in src/WorkflowCommand.php - About 1 hr to fix

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

                public function execute(InputInterface $input, OutputInterface $output): int
                {
                    if (0 === $totalWorkerCount = \count($jobWorkers = $this->workers)) {
                        return self::FAILURE;
                    }
            Severity: Minor
            Found in src/WorkflowCommand.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 work has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function work(Monorepo $repo, InputInterface $input, SymfonyStyle $output): int
                {
                    [$mainRepo, $branches] = [$repo->getRepository(), $input->getOption('branch')];
                    $currentBranch = $mainRepo->getBranch()->getName();
            
            
            Severity: Minor
            Found in src/Worker/SplitCommitsWorker.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 work has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function work(Monorepo $repo, InputInterface $input, SymfonyStyle $output): int
                {
                    $mainRepo = $repo->getRepository();
                    $output->writeln('<info>Checking git filter-repo command existence...</info>');
            
            
            Severity: Minor
            Found in src/Worker/MergeRepoWorker.php - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Severity
            Category
            Status
            Source
            Language