poisl/pc_event_scheduler

View on GitHub

Showing 22 of 22 total issues

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

<?php
namespace PoiCom\PcEventScheduler\Tests\Unit\Controller;
/***************************************************************
 *  Copyright notice
 *
Severity: Major
Found in Tests/Unit/Controller/ParticipantControllerTest.php and 2 other locations - About 3 days to fix
Tests/Unit/Controller/EventControllerTest.php on lines 1..138
Tests/Unit/Controller/HolidayControllerTest.php on lines 1..138

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

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

<?php
namespace PoiCom\PcEventScheduler\Tests\Unit\Controller;
/***************************************************************
 *  Copyright notice
 *
Severity: Major
Found in Tests/Unit/Controller/HolidayControllerTest.php and 2 other locations - About 3 days to fix
Tests/Unit/Controller/EventControllerTest.php on lines 1..138
Tests/Unit/Controller/ParticipantControllerTest.php on lines 1..138

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

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

<?php
namespace PoiCom\PcEventScheduler\Tests\Unit\Controller;
/***************************************************************
 *  Copyright notice
 *
Severity: Major
Found in Tests/Unit/Controller/EventControllerTest.php and 2 other locations - About 3 days to fix
Tests/Unit/Controller/HolidayControllerTest.php on lines 1..138
Tests/Unit/Controller/ParticipantControllerTest.php on lines 1..138

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

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

    public function createAction(\PoiCom\PcEventScheduler\Domain\Model\Holiday $holiday)
    {
        if (!$this->div->isLoggedUserInGroup($this->settings['eventAdminGroupId'])) {
            $this->addFlashMessage($this->div->translate('message.noAdmin', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
            $this->redirect('list');
Severity: Major
Found in Classes/Controller/HolidayController.php and 2 other locations - About 2 hrs to fix
Classes/Controller/HolidayController.php on lines 111..120
Classes/Controller/HolidayController.php on lines 128..137

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

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

    public function deleteAction(\PoiCom\PcEventScheduler\Domain\Model\Holiday $holiday)
    {
        if (!$this->div->isLoggedUserInGroup($this->settings['eventAdminGroupId'])) {
            $this->addFlashMessage($this->div->translate('message.noAdmin', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
            $this->redirect('list');
Severity: Major
Found in Classes/Controller/HolidayController.php and 2 other locations - About 2 hrs to fix
Classes/Controller/HolidayController.php on lines 82..91
Classes/Controller/HolidayController.php on lines 111..120

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

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

    public function updateAction(\PoiCom\PcEventScheduler\Domain\Model\Holiday $holiday)
    {
        if (!$this->div->isLoggedUserInGroup($this->settings['eventAdminGroupId'])) {
            $this->addFlashMessage($this->div->translate('message.noAdmin', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
            $this->redirect('list');
Severity: Major
Found in Classes/Controller/HolidayController.php and 2 other locations - About 2 hrs to fix
Classes/Controller/HolidayController.php on lines 82..91
Classes/Controller/HolidayController.php on lines 128..137

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

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

Method notifyCommand has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function notifyCommand()
    {
        $this->settings = $this->configurationManager->getConfiguration(
            ConfigurationManager::CONFIGURATION_TYPE_SETTINGS
        );
Severity: Minor
Found in Classes/Command/NotifyCommandController.php - About 1 hr to fix

    Method cancelAction has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function cancelAction()
        {
            if (!$this->div->isLoggedUserInGroup($this->settings['participantGroupId'])) {
                $this->addFlashMessage($this->div->translate('message.noParticipant', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
                $this->redirect('list');
    Severity: Minor
    Found in Classes/Controller/EventController.php - About 1 hr to fix

      Method acceptAction has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function acceptAction()
          {
              if (!$this->div->isLoggedUserInGroup($this->settings['participantGroupId'])) {
                  $this->addFlashMessage($this->div->translate('message.noParticipant', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
                  $this->redirect('list');
      Severity: Minor
      Found in Classes/Controller/EventController.php - About 1 hr to fix

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

            public function addParticipantToObjectStorageHoldingParticipants()
            {
                $participant = new \PoiCom\PcEventScheduler\Domain\Model\Participant();
                $participantsObjectStorageMock = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', array('attach'), array(), '', FALSE);
                $participantsObjectStorageMock->expects($this->once())->method('attach')->with($this->equalTo($participant));
        Severity: Major
        Found in Tests/Unit/Domain/Model/EventTest.php and 1 other location - About 1 hr to fix
        Tests/Unit/Domain/Model/EventTest.php on lines 213..222

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

        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 removeParticipantFromObjectStorageHoldingParticipants()
            {
                $participant = new \PoiCom\PcEventScheduler\Domain\Model\Participant();
                $participantsObjectStorageMock = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', array('detach'), array(), '', FALSE);
                $participantsObjectStorageMock->expects($this->once())->method('detach')->with($this->equalTo($participant));
        Severity: Major
        Found in Tests/Unit/Domain/Model/EventTest.php and 1 other location - About 1 hr to fix
        Tests/Unit/Domain/Model/EventTest.php on lines 200..208

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

        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

        Method listAction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function listAction()
            {
                if (!$this->div->isLoggedUserInGroup($this->settings['participantGroupId'])) {
                    $this->addFlashMessage($this->div->translate('message.noParticipant', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
                    $this->redirect('list');
        Severity: Minor
        Found in Classes/Controller/StatisticsController.php - About 1 hr to fix

          Method calculateAverageAcceptsPerEventByYear has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function calculateAverageAcceptsPerEventByYear($year, $accept){
                     $currentYear = date("Y");
                  
                  $lastDayInYear = new \DateTime();
                  $lastDayInYear -> setDate($year, 12, 31);
          Severity: Minor
          Found in Classes/Domain/Repository/EventRepository.php - About 1 hr to fix

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

                public function cancelAction()
                {
                    if (!$this->div->isLoggedUserInGroup($this->settings['participantGroupId'])) {
                        $this->addFlashMessage($this->div->translate('message.noParticipant', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
                        $this->redirect('list');
            Severity: Minor
            Found in Classes/Controller/EventController.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 acceptAction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public function acceptAction()
                {
                    if (!$this->div->isLoggedUserInGroup($this->settings['participantGroupId'])) {
                        $this->addFlashMessage($this->div->translate('message.noParticipant', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
                        $this->redirect('list');
            Severity: Minor
            Found in Classes/Controller/EventController.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 topParticipantsByYear has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function topParticipantsByYear($year){
                    $currentYear = date("Y");
                    
                    $lastDayInYear = new \DateTime();
                    $lastDayInYear -> setDate($year, 12, 31);
            Severity: Minor
            Found in Classes/Domain/Repository/EventRepository.php - About 1 hr to fix

              Identical blocks of code found in 5 locations. Consider refactoring.
              Open

                      if ($this->request->hasArgument('offset')) {
                          $offset = $this->request->getArgument('offset');
                          if ($offset < 0) {
                              $this->addFlashMessage($this->div->translate('message.pastEventError', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
                              $this->redirect('list', Null, Null, array('offset'=>$offset));
              Severity: Major
              Found in Classes/Controller/EventController.php and 4 other locations - About 55 mins to fix
              Classes/Controller/EventController.php on lines 112..118
              Classes/Controller/EventController.php on lines 165..171
              Classes/Controller/EventController.php on lines 283..289
              Classes/Controller/EventController.php on lines 316..322

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

              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

              Identical blocks of code found in 5 locations. Consider refactoring.
              Open

                      if ($this->request->hasArgument('offset')) {
                          $offset = $this->request->getArgument('offset');
                          if ($offset < 0) {
                              $this->addFlashMessage($this->div->translate('message.pastEventError', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
                              $this->redirect('list', Null, Null, array('offset'=>$offset));
              Severity: Major
              Found in Classes/Controller/EventController.php and 4 other locations - About 55 mins to fix
              Classes/Controller/EventController.php on lines 112..118
              Classes/Controller/EventController.php on lines 165..171
              Classes/Controller/EventController.php on lines 251..257
              Classes/Controller/EventController.php on lines 316..322

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

              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

              Identical blocks of code found in 5 locations. Consider refactoring.
              Open

                      if ($this->request->hasArgument('offset')) {
                          $offset = $this->request->getArgument('offset');
                          if ($offset < 0) {
                              $this->addFlashMessage($this->div->translate('message.pastEventError', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
                              $this->redirect('list', Null, Null, array('offset'=>$offset));
              Severity: Major
              Found in Classes/Controller/EventController.php and 4 other locations - About 55 mins to fix
              Classes/Controller/EventController.php on lines 112..118
              Classes/Controller/EventController.php on lines 251..257
              Classes/Controller/EventController.php on lines 283..289
              Classes/Controller/EventController.php on lines 316..322

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

              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

              Identical blocks of code found in 5 locations. Consider refactoring.
              Open

                      if ($this->request->hasArgument('offset')) {
                          $offset = $this->request->getArgument('offset');
                          if ($offset < 0) {
                              $this->addFlashMessage($this->div->translate('message.pastEventError', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
                              $this->redirect('list', Null, Null, array('offset'=>$offset));
              Severity: Major
              Found in Classes/Controller/EventController.php and 4 other locations - About 55 mins to fix
              Classes/Controller/EventController.php on lines 112..118
              Classes/Controller/EventController.php on lines 165..171
              Classes/Controller/EventController.php on lines 251..257
              Classes/Controller/EventController.php on lines 283..289

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

              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

              Severity
              Category
              Status
              Source
              Language