FrankProjects/UltimateWarfare

View on GitHub

Showing 131 of 131 total issues

Method constructGameUnits has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function constructGameUnits(Request $request, int $regionId, int $gameUnitTypeId): Response
    {
        /**
         * XXX TODO: Fix unit info page
         * XXX TODO: Fix buildtime to human readable format
Severity: Minor
Found in src/Controller/Game/ConstructionController.php - About 1 hr to fix

    Method uploadAvatar has 37 lines of code (exceeds 25 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 1 hr to fix

      Method executeOperation has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

            public function leaveFederation(Request $request): Response
            {
                try {
                    if ($request->isMethod(Request::METHOD_POST)) {
                        $this->federationActionService->leaveFederation($this->getPlayer());
        Severity: Major
        Found in src/Controller/Game/FederationController.php and 1 other location - About 1 hr to fix
        src/Controller/Game/FederationController.php on lines 166..185

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

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

            public function removeFederation(Request $request): Response
            {
                try {
                    if ($request->isMethod(Request::METHOD_POST)) {
                        $this->federationActionService->removeFederation($this->getPlayer());
        Severity: Major
        Found in src/Controller/Game/FederationController.php and 1 other location - About 1 hr to fix
        src/Controller/Game/FederationController.php on lines 208..227

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

        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

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

            public function sendGameUnits(
                WorldRegion $region,
                WorldRegion $targetRegion,
                Player $player,
                GameUnitType $gameUnitType,
        Severity: Minor
        Found in src/Service/Action/FleetActionService.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 edit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function edit(Request $request, UserPasswordHasherInterface $passwordHasher): Response
            {
                $user = $this->getGameUser();
                $changePasswordForm = $this->createForm(ChangePasswordType::class, $user);
                $changePasswordForm->handleRequest($request);
        Severity: Minor
        Found in src/Controller/Game/UserController.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 generateWorldRegions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private function generateWorldRegions(
                WorldSector $worldSector,
                array $map,
                MapConfiguration $mapConfiguration
            ): void {
        Severity: Minor
        Found in src/Service/WorldGeneratorService.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 research has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function research(): Response
            {
                $player = $this->getPlayer();
                $ongoingResearch = $this->researchRepository->findOngoingByPlayer($player);
                $unresearched = $this->researchRepository->findUnresearchedByPlayer($player);
        Severity: Minor
        Found in src/Controller/Game/ResearchController.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 remove has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function remove(Player $player): void
            {
                foreach ($player->getMarketItems() as $marketItem) {
                    $this->entityManager->remove($marketItem);
                }
        Severity: Minor
        Found in src/Repository/Doctrine/DoctrinePlayerRepository.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 withdraw has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function withdraw(Player $player, array $resources): void
            {
                $this->ensureFederationEnabled($player);
        
                $federation = $player->getFederation();
        Severity: Minor
        Found in src/Service/Action/FederationBankActionService.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 addFleetUnitToFleet has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private function addFleetUnitToFleet(WorldRegion $region, GameUnit $gameUnit, int $amount, Fleet $fleet): void
            {
                $hasUnit = false;
                foreach ($region->getWorldRegionUnits() as $regionUnit) {
                    if ($regionUnit->getGameUnit()->getId() == $gameUnit->getId()) {
        Severity: Minor
        Found in src/Service/Action/FleetActionService.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 processSuccess has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function processSuccess(): void
            {
                $totalBuildings = 0;
                foreach ($this->region->getWorldRegionUnits() as $worldRegionUnit) {
                    if ($worldRegionUnit->getGameUnit()->getGameUnitType()->getId() == GameUnitType::GAME_UNIT_TYPE_BUILDINGS) {
        Severity: Minor
        Found in src/Service/OperationEngine/OperationProcessor/MissileAttack.php - About 1 hr to fix

          Method removeGameUnits has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function removeGameUnits(Request $request, int $regionId, int $gameUnitTypeId): Response
              {
                  try {
                      $worldRegion = $this->regionActionService->getWorldRegionByIdAndPlayer($regionId, $this->getPlayer());
                  } catch (WorldRegionNotFoundException $e) {
          Severity: Minor
          Found in src/Controller/Game/ConstructionController.php - About 1 hr to fix

            Method research has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function research(): Response
                {
                    $player = $this->getPlayer();
                    $ongoingResearch = $this->researchRepository->findOngoingByPlayer($player);
                    $unresearched = $this->researchRepository->findUnresearchedByPlayer($player);
            Severity: Minor
            Found in src/Controller/Game/ResearchController.php - About 1 hr to fix

              Method edit has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function edit(Request $request, int $topicId): Response
                  {
                      try {
                          $this->ensureForumEnabled();
                      } catch (ForumDisabledException) {
              Severity: Minor
              Found in src/Controller/Forum/TopicController.php - About 1 hr to fix

                Method edit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function edit(Request $request, UserPasswordHasherInterface $passwordHasher): Response
                    {
                        $user = $this->getGameUser();
                        $changePasswordForm = $this->createForm(ChangePasswordType::class, $user);
                        $changePasswordForm->handleRequest($request);
                Severity: Minor
                Found in src/Controller/Game/UserController.php - About 1 hr to fix

                  Method withdraw has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function withdraw(Player $player, array $resources): void
                      {
                          $this->ensureFederationEnabled($player);
                  
                          $federation = $player->getFederation();
                  Severity: Minor
                  Found in src/Service/Action/FederationBankActionService.php - About 1 hr to fix

                    Method acceptFederationApplication has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function acceptFederationApplication(Player $player, int $applicationId): void
                        {
                            $this->ensureFederationEnabled($player);
                    
                            $federationApplication = $this->getFederationApplication($player, $applicationId);
                    Severity: Minor
                    Found in src/Service/Action/FederationApplicationActionService.php - About 1 hr to fix

                      Method selectGameUnits has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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