autowp/autowp

View on GitHub

Showing 1,718 of 1,718 total issues

Method indexAction has 202 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function indexAction()
    {
        $isModer = $this->user()->enforce('global', 'moderate');
        $user    = $this->user()->get();

Severity: Major
Found in module/Application/src/Controller/Api/PictureController.php - About 1 day to fix

    Method galleryAction has 198 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function galleryAction()
        {
            $itemId = (int) $this->params()->fromQuery('item_id');
    
            $filter = [
    Severity: Major
    Found in module/Application/src/Controller/Api/GalleryController.php - About 7 hrs to fix

      Function userValuePatchAction has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
      Open

          public function userValuePatchAction()
          {
              $user = $this->user()->get();
      
              if (! $user) {
      Severity: Minor
      Found in module/Application/src/Controller/Api/AttrController.php - About 7 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

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

          public function normalizeAction()
          {
              if (! $this->user()->enforce('global', 'moderate')) {
                  return $this->forbiddenAction();
              }
      Severity: Major
      Found in module/Application/src/Controller/Api/PictureController.php and 1 other location - About 7 hrs to fix
      module/Application/src/Controller/Api/PictureController.php on lines 1167..1201

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

      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 flopAction()
          {
              if (! $this->user()->enforce('global', 'moderate')) {
                  return $this->forbiddenAction();
              }
      Severity: Major
      Found in module/Application/src/Controller/Api/PictureController.php and 1 other location - About 7 hrs to fix
      module/Application/src/Controller/Api/PictureController.php on lines 1126..1160

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

      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

      File PictureNameFormatterTest.php has 454 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace ApplicationTest;
      
      use Application\PictureNameFormatter;
      Severity: Minor
      Found in module/Application/test/PictureNameFormatterTest.php - About 6 hrs to fix

        Method postAction has 168 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function postAction()
            {
                if (! $this->user()->enforce('car', 'add')) {
                    return $this->forbiddenAction();
                }
        Severity: Major
        Found in module/Application/src/Controller/Api/ItemController.php - About 6 hrs to fix

          Method testCarsSpecificationsEditor has 165 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testCarsSpecificationsEditor(): void
              {
                  $this->reset();
                  /** @var Request $request */
                  $request = $this->getRequest();
          Severity: Major
          Found in module/Application/test/Controller/Frontend/CarsControllerTest.php - About 6 hrs to fix

            Function getCataloguePaths has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getCataloguePaths(int $id, array $options = []): array
                {
                    if (! $id) {
                        throw new InvalidArgumentException("Unexpected `id`");
                    }
            Severity: Minor
            Found in module/Application/src/Model/Catalogue.php - About 6 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

            File ItemParentController.php has 434 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace Application\Controller\Api;
            
            use Application\Controller\Plugin\Car;
            Severity: Minor
            Found in module/Application/src/Controller/Api/ItemParentController.php - About 6 hrs to fix

              Function getAttributes has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getAttributes(array $options = []): array
                  {
                      $defaults = [
                          'zone'      => null,
                          'parent'    => null,
              Severity: Minor
              Found in module/Application/src/Service/SpecificationsService.php - About 5 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 getData has 145 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getData(array $options): array
                  {
                      $defaults = [
                          'language' => null,
                          'most'     => null,
              Severity: Major
              Found in module/Application/src/Service/Mosts.php - About 5 hrs to fix

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

                    private function createItem(array $params): int
                    {
                        $this->reset();
                
                        /** @var Request $request */
                module/Application/test/Controller/Api/InboxControllerTest.php on lines 51..75
                module/Application/test/Controller/Api/PictureControllerTest.php on lines 102..126
                module/Application/test/Controller/Api/PictureModerVoteControllerTest.php on lines 100..124
                module/Application/test/Controller/Frontend/CarsControllerTest.php on lines 25..49
                module/Application/test/Controller/Frontend/FactoryControllerTest.php on lines 25..49

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

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

                    private function createItem(array $params): int
                    {
                        $this->reset();
                
                        /** @var Request $request */
                module/Application/test/Controller/Api/InboxControllerTest.php on lines 51..75
                module/Application/test/Controller/Api/ItemControllerTest.php on lines 37..61
                module/Application/test/Controller/Api/PictureControllerTest.php on lines 102..126
                module/Application/test/Controller/Frontend/CarsControllerTest.php on lines 25..49
                module/Application/test/Controller/Frontend/FactoryControllerTest.php on lines 25..49

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

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

                    private function createItem(array $params): int
                    {
                        $this->reset();
                
                        /** @var Request $request */
                module/Application/test/Controller/Api/InboxControllerTest.php on lines 51..75
                module/Application/test/Controller/Api/ItemControllerTest.php on lines 37..61
                module/Application/test/Controller/Api/PictureControllerTest.php on lines 102..126
                module/Application/test/Controller/Api/PictureModerVoteControllerTest.php on lines 100..124
                module/Application/test/Controller/Frontend/CarsControllerTest.php on lines 25..49

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

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

                    private function createItem(array $params): int
                    {
                        $this->reset();
                
                        /** @var Request $request */
                module/Application/test/Controller/Api/ItemControllerTest.php on lines 37..61
                module/Application/test/Controller/Api/PictureControllerTest.php on lines 102..126
                module/Application/test/Controller/Api/PictureModerVoteControllerTest.php on lines 100..124
                module/Application/test/Controller/Frontend/CarsControllerTest.php on lines 25..49
                module/Application/test/Controller/Frontend/FactoryControllerTest.php on lines 25..49

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

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

                    private function createItem(array $params): int
                    {
                        $this->reset();
                
                        /** @var Request $request */
                module/Application/test/Controller/Api/InboxControllerTest.php on lines 51..75
                module/Application/test/Controller/Api/ItemControllerTest.php on lines 37..61
                module/Application/test/Controller/Api/PictureControllerTest.php on lines 102..126
                module/Application/test/Controller/Api/PictureModerVoteControllerTest.php on lines 100..124
                module/Application/test/Controller/Frontend/FactoryControllerTest.php on lines 25..49

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

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

                    private function createItem(array $params): int
                    {
                        $this->reset();
                
                        /** @var Request $request */
                module/Application/test/Controller/Api/InboxControllerTest.php on lines 51..75
                module/Application/test/Controller/Api/ItemControllerTest.php on lines 37..61
                module/Application/test/Controller/Api/PictureModerVoteControllerTest.php on lines 100..124
                module/Application/test/Controller/Frontend/CarsControllerTest.php on lines 25..49
                module/Application/test/Controller/Frontend/FactoryControllerTest.php on lines 25..49

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

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

                    public function setUserValue2(int $uid, int $attributeId, int $itemId, $value, bool $empty): void
                    {
                        $attribute = $this->getAttribute($attributeId);
                        if (! $attribute) {
                            throw new Exception("attribute `$attributeId` not found");
                Severity: Minor
                Found in module/Application/src/Service/SpecificationsService.php - About 5 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

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

                        if ($car['spec_inherit']) {
                            $map = [];
                            foreach ($parents as $parent) {
                                $specId = $parent['spec_id'];
                                if ($specId) {
                Severity: Major
                Found in module/Application/src/Model/Item.php and 1 other location - About 5 hrs to fix
                module/Application/src/Model/Item.php on lines 583..612

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

                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