FrankProjects/UltimateWarfare

View on GitHub

Showing 103 of 141 total issues

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 generateForWorld has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function generateForWorld(World $world, string $path): void
    {
        $size = (int)sqrt(count($world->getWorldRegions())) * 5;
        if ($size === 0) {
            throw new RuntimeException("Not enough WorldRegions");
Severity: Minor
Found in src/Service/WorldGenerator/ImageBuilder/WorldImageBuilder.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

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

Avoid too many return statements within this method.
Open

        return $this->render(
            'forum/category/edit.html.twig',
            [
                'category' => $category,
                'user' => $this->getGameUser(),
Severity: Major
Found in src/Controller/Forum/CategoryController.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $this->redirectToRoute('Game/Fleets', [], 302);
    Severity: Major
    Found in src/Controller/Game/AttackController.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return $this->render(
                  'forum/topic_edit.html.twig',
                  [
                      'topic' => $topic,
                      'user' => $this->getGameUser(),
      Severity: Major
      Found in src/Controller/Forum/TopicController.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $this->render(
                    'game/region/attackSelectGameUnits.html.twig',
                    [
                        'region' => $worldRegion,
                        'playerRegion' => $playerRegion,
        Severity: Major
        Found in src/Controller/Game/AttackController.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $this->render(
                      'game/operation/selectGameUnit.html.twig',
                      [
                          'region' => $worldRegion,
                          'playerRegion' => $playerRegion,
          Severity: Major
          Found in src/Controller/Game/OperationController.php - About 30 mins to fix

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

                public function attackSelectGameUnits(Request $request, int $regionId, int $playerRegionId): Response
                {
                    $player = $this->getPlayer();
            
                    try {
            Severity: Minor
            Found in src/Controller/Game/AttackController.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

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

                private function changeSettings(Request $request): void
                {
                    $user = $this->getGameUser();
            
                    if ($request->request->get('adviser') !== null) {
            Severity: Minor
            Found in src/Controller/Game/UserController.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

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

                public function processPlayerIncome(Player $player, int $timestamp): bool
                {
                    // Don't update player income more than once every minute...
                    if ($player->getTimestampUpdate() + 60 > $timestamp) {
                        return true;
            Severity: Minor
            Found in src/Service/GameEngine.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

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

                public function topic(Request $request, int $topicId): Response
                {
                    try {
                        $this->ensureForumEnabled();
                    } catch (ForumDisabledException) {
            Severity: Minor
            Found in src/Controller/Forum/TopicController.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

            Function executeOperation has a Cognitive Complexity of 6 (exceeds 5 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 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

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

                public function changePlayerHierarchy(Player $player, int $playerId, int $role): void
                {
                    $this->ensureFederationEnabled($player);
                    $federation = $player->getFederation();
                    if ($federation === null) {
            Severity: Minor
            Found in src/Service/Action/FederationActionService.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

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

                public function edit(Request $request, int $postId): Response
                {
                    try {
                        $this->ensureForumEnabled();
                    } catch (ForumDisabledException) {
            Severity: Minor
            Found in src/Controller/Forum/PostController.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

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

                public function performCancel(int $researchId, Player $player): void
                {
                    $research = $this->getResearchById($researchId);
            
                    /** @var ResearchPlayer $playerResearch */
            Severity: Minor
            Found in src/Service/Action/ResearchActionService.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

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

                private function removeGameUnitsFromWorldRegion(WorldRegion $worldRegion, GameUnit $gameUnit, int $amount): void
                {
                    foreach ($worldRegion->getWorldRegionUnits() as $worldRegionUnit) {
                        if ($worldRegionUnit->getGameUnit()->getId() !== $gameUnit->getId()) {
                            continue;
            Severity: Minor
            Found in src/Service/Action/ConstructionActionService.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

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

                public function create(Request $request, int $categoryId): Response
                {
                    try {
                        $this->ensureForumEnabled();
                    } catch (ForumDisabledException) {
            Severity: Minor
            Found in src/Controller/Forum/TopicController.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

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

                private function octave(int $size, float $persistence, int $octave): void
                {
                    $freq = pow(2, $octave);
                    $amp = pow($persistence, $octave);
            
            
            Severity: Minor
            Found in src/Service/WorldGenerator/PerlinNoiseGenerator.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