autowp/autowp

View on GitHub

Showing 1,718 of 1,718 total issues

Method putAction has 333 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    File ItemParent.php has 720 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Application\Model;
    
    use ArrayAccess;
    Severity: Major
    Found in module/Application/src/Model/ItemParent.php - About 1 day to fix

      File Mosts.php has 710 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Application\Service;
      
      use Application\Model\ItemParent;
      Severity: Major
      Found in module/Application/src/Service/Mosts.php - About 1 day to fix

        Function updateItemInteritance has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
        Open

            private function updateItemInteritance($car): void
            {
                $parents = $this->getRows([
                    'child' => $car['id'],
                ]);
        Severity: Minor
        Found in module/Application/src/Model/Item.php - About 1 day 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

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

            private function addPictureToItem(int $vehicleId): int
            {
                $this->reset();
        
                $this->mockDuplicateFinder();
        module/Application/test/Controller/Api/InboxControllerTest.php on lines 88..133
        module/Application/test/Controller/Api/ItemControllerTest.php on lines 186..231
        module/Application/test/Controller/Api/PictureControllerTest.php on lines 51..97

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

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

            private function addPictureToItem(int $vehicleId): int
            {
                $this->reset();
        
                $this->mockDuplicateFinder();
        module/Application/test/Controller/Api/InboxControllerTest.php on lines 88..133
        module/Application/test/Controller/Api/ItemControllerTest.php on lines 186..231
        module/Application/test/Controller/Api/PictureModerVoteControllerTest.php on lines 50..95

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

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

            private function addPictureToItem(int $vehicleId): int
            {
                $this->reset();
        
                $this->mockDuplicateFinder();
        module/Application/test/Controller/Api/InboxControllerTest.php on lines 88..133
        module/Application/test/Controller/Api/PictureControllerTest.php on lines 51..97
        module/Application/test/Controller/Api/PictureModerVoteControllerTest.php on lines 50..95

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

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

            private function addPictureToItem(int $vehicleId): int
            {
                $this->reset();
        
                $this->mockDuplicateFinder();
        module/Application/test/Controller/Api/ItemControllerTest.php on lines 186..231
        module/Application/test/Controller/Api/PictureControllerTest.php on lines 51..97
        module/Application/test/Controller/Api/PictureModerVoteControllerTest.php on lines 50..95

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

        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 getInputFilter has 280 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getInputFilter(int $itemTypeId, bool $post, ?int $itemId): InputFilterInterface
            {
                $select = new Sql\Select($this->specTable->getTable());
                $select->columns(['id']);
                $specOptions = [];
        Severity: Major
        Found in module/Application/src/Controller/Api/ItemController.php - About 1 day to fix

          Method updateAction has 278 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function updateAction()
              {
                  $user = $this->user()->get();
                  if (! $user) {
                      return $this->forbiddenAction();
          Severity: Major
          Found in module/Application/src/Controller/Api/PictureController.php - About 1 day to fix

            Function indexAction has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
            Open

                public function indexAction()
                {
                    $isModer = $this->user()->enforce('global', 'moderate');
                    $user    = $this->user()->get();
            
            
            Severity: Minor
            Found in module/Application/src/Controller/Api/PictureController.php - About 1 day 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 getSelect has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getSelect(array $options): Sql\Select
                {
                    $defaults = [
                        'id'                   => null,
                        'columns'              => null,
            Severity: Minor
            Found in module/Application/src/Model/Item.php - About 1 day 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 ItemControllerTest.php has 614 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace ApplicationTest\Controller\Api;
            
            use Application\Controller\Api\ItemController;
            Severity: Major
            Found in module/Application/test/Controller/Api/ItemControllerTest.php - About 1 day to fix

              SpecificationsService has 64 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class SpecificationsService
              {
                  private const
                      DEFAULT_ZONE_ID = 1,
                      ENGINE_ZONE_ID  = 5,
              Severity: Major
              Found in module/Application/src/Service/SpecificationsService.php - About 1 day to fix

                Function extract has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function extract($object): ?array
                    {
                        $deleted = (bool) $object['deleted'];
                
                        $isMe = (int) $object['id'] === $this->userId;
                Severity: Minor
                Found in module/Application/src/Hydrator/Api/UserHydrator.php - About 1 day 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 setUserValue has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function setUserValue(int $uid, int $attributeId, int $itemId, $value): 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 1 day 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 galleryAction has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function galleryAction()
                    {
                        $itemId = (int) $this->params()->fromQuery('item_id');
                
                        $filter = [
                Severity: Minor
                Found in module/Application/src/Controller/Api/GalleryController.php - About 1 day 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 getSelect has 207 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getSelect(array $options): Sql\Select
                    {
                        $defaults = [
                            'id'                   => null,
                            'columns'              => null,
                Severity: Major
                Found in module/Application/src/Model/Item.php - About 1 day to fix

                  Function applyFilters has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function applyFilters(Sql\Select $select, array $options, string $id, string $prefix): array
                      {
                          $defaults = [
                              'id'                 => null,
                              'item_type_id'       => null,
                  Severity: Minor
                  Found in module/Application/src/Model/Item.php - About 1 day 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 postAction has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function postAction()
                      {
                          if (! $this->user()->enforce('car', 'add')) {
                              return $this->forbiddenAction();
                          }
                  Severity: Minor
                  Found in module/Application/src/Controller/Api/ItemController.php - About 1 day 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