FrankProjects/UltimateWarfare

View on GitHub

Showing 103 of 141 total issues

Method sector has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function sector(int $sectorId): Response
    {
        $player = $this->getPlayer();
        $sector = $this->worldSectorRepository->findByIdAndWorld($sectorId, $player->getWorld());

Severity: Minor
Found in src/Controller/Game/SectorController.php - About 1 hr to fix

    Method selectWorldRegion has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function selectWorldRegion(int $regionId, int $operationId): Response
        {
            $player = $this->getPlayer();
            $playerRegions = [];
            $worldRegion = null;
    Severity: Minor
    Found in src/Controller/Game/OperationController.php - About 1 hr to fix

      Method selectOperation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function selectOperation(Request $request, int $regionId): Response
          {
              $player = $this->getPlayer();
      
              try {
      Severity: Minor
      Found in src/Controller/Game/OperationController.php - About 1 hr to fix

        Function showLogs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function showLogs(): Response
            {
                $finder = new Finder();
                $finder->in($this->getParameter('kernel.project_dir') . '/var/log');
                $finder->name('*.log');
        Severity: Minor
        Found in src/Controller/Admin/ServerLogsController.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 ensureCanResearch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function ensureCanResearch(Research $research, Player $player): void
            {
                $researchArray = [];
        
                /** @var ResearchPlayer $playerResearch */
        Severity: Minor
        Found in src/Service/Action/ResearchActionService.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

        Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                ReportCreator $reportCreator,
                NetworthUpdaterService $networthUpdaterService,
                IncomeUpdaterService $incomeUpdaterService,
                PlayerRepository $playerRepository,
                WorldRegionUnitRepository $worldRegionUnitRepository,
        Severity: Major
        Found in src/Service/OperationService.php - About 50 mins to fix

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

              private function generateWorldSectors(
                  World $world,
                  array $map,
                  MapConfiguration $mapConfiguration,
                  int $sector
          Severity: Minor
          Found in src/Service/WorldGeneratorService.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

          Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  ConstructionRepository $constructionRepository,
                  GameUnitRepository $gameUnitRepository,
                  PlayerRepository $playerRepository,
                  WorldRegionUnitRepository $worldRegionUnitRepository,
                  NetworthUpdaterService $networthUpdaterService
          Severity: Minor
          Found in src/Service/Action/ConstructionActionService.php - About 35 mins to fix

            Method placeOffer has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function placeOffer(Player $player, string $gameResource, int $price, int $amount, string $action): void
            Severity: Minor
            Found in src/Service/Action/MarketActionService.php - About 35 mins to fix

              Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      OperationRepository $operationRepository,
                      WorldRegionRepository $worldRegionRepository,
                      GameUnitTypeRepository $gameUnitTypeRepository,
                      RegionActionService $regionActionService,
                      OperationService $operationService
              Severity: Minor
              Found in src/Controller/Game/OperationController.php - About 35 mins to fix

                Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        WorldRegionRepository $worldRegionRepository,
                        PlayerRepository $playerRepository,
                        FederationRepository $federationRepository,
                        DistanceCalculator $distanceCalculator,
                        TimeCalculator $timeCalculator
                Severity: Minor
                Found in src/Service/Action/RegionActionService.php - About 35 mins to fix

                  Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          ConstructionRepository $constructionRepository,
                          PlayerRepository $playerRepository,
                          ReportRepository $reportRepository,
                          WorldRegionUnitRepository $worldRegionUnitRepository,
                          NetworthUpdaterService $networthUpdaterService
                  Severity: Minor
                  Found in src/Service/GameEngine/Processor/ConstructionProcessor.php - About 35 mins to fix

                    Method sendGameUnits has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            WorldRegion $region,
                            WorldRegion $targetRegion,
                            Player $player,
                            GameUnitType $gameUnitType,
                            array $unitData
                    Severity: Minor
                    Found in src/Service/Action/FleetActionService.php - About 35 mins to fix

                      Method sendMessage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              Player $player,
                              string $subject,
                              string $message,
                              string $toPlayerName,
                              bool $adminMessage
                      Severity: Minor
                      Found in src/Service/Action/MessageActionService.php - About 35 mins to fix

                        Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                FederationRepository $federationRepository,
                                FederationApplicationRepository $federationApplicationRepository,
                                FederationNewsRepository $federationNewsRepository,
                                PlayerRepository $playerRepository,
                                ReportRepository $reportRepository
                        Severity: Minor
                        Found in src/Service/Action/FederationApplicationActionService.php - About 35 mins to fix

                          Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  WorldRepository $worldRepository,
                                  WorldRegionRepository $worldRegionRepository,
                                  WorldSectorRepository $worldSectorRepository,
                                  PerlinNoiseGenerator $worldGenerator,
                                  WorldImageGeneratorService $worldImageGeneratorService
                          Severity: Minor
                          Found in src/Service/WorldGeneratorService.php - About 35 mins to fix

                            Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    ConstructionRepository $constructionRepository,
                                    GameUnitTypeRepository $gameUnitTypeRepository,
                                    WorldRegionRepository $worldRegionRepository,
                                    ConstructionActionService $constructionActionService,
                                    RegionActionService $regionActionService
                            Severity: Minor
                            Found in src/Controller/Game/ConstructionController.php - About 35 mins to fix

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

                                  public function generateForWorldSector(WorldSector $worldSector, string $path): void
                                  {
                                      $worldSectorRegionsCount = count($worldSector->getWorldRegions());
                                      $size = (int)sqrt($worldSectorRegionsCount) * 25;
                                      if ($size === 0) {
                              Severity: Minor
                              Found in src/Service/WorldGenerator/ImageBuilder/WorldSectorImageBuilder.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

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

                                  public function uploadAvatar(Request $request): Response
                                  {
                                      $user = $this->getGameUser();
                                      $form = $this->createForm(UploadAvatarType::class);
                                      $form->handleRequest($request);
                              Severity: Minor
                              Found in src/Controller/Game/UserController.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

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

                                  private function hasWorldRegionGameUnitAmount(WorldRegion $region, Operation $operation, int $amount): void
                                  {
                                      if ($amount < 1) {
                                          throw new RuntimeException("Can not send negative game units");
                                      }
                              Severity: Minor
                              Found in src/Service/OperationService.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

                              Severity
                              Category
                              Status
                              Source
                              Language