ernestwisniewski/kbin

View on GitHub

Showing 464 of 573 total issues

Method __invoke has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    #[OA\Response(
        response: 200,
        description: 'Returns a paginated list of Entries',
        content: new OA\JsonContent(
            type: 'object',
Severity: Minor
Found in src/Controller/Api/Entry/MagazineEntriesRetrieveApi.php - About 1 hr to fix

    Method __invoke has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        #[OA\Response(
            response: 200,
            description: 'Returns a paginated list of comments from a specific user',
            content: new OA\JsonContent(
                type: 'object',
    Severity: Minor
    Found in src/Controller/Api/Entry/Comments/UserEntryCommentsRetrieveApi.php - About 1 hr to fix

      Method subscribed has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          #[OA\Response(
              response: 200,
              description: 'A paginated list of posts from user\'s subscribed magazines',
              content: new OA\JsonContent(
                  type: 'object',
      Severity: Minor
      Found in src/Controller/Api/Post/PostsRetrieveApi.php - About 1 hr to fix

        Method __invoke has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            #[OA\Response(
                response: 200,
                description: 'A paginated list of posts from the user',
                content: new OA\JsonContent(
                    type: 'object',
        Severity: Minor
        Found in src/Controller/Api/Post/UserPostsRetrieveApi.php - About 1 hr to fix

          Method __invoke has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              #[OA\Response(
                  response: 200,
                  description: 'Returns a paginated list of entries from a specific domain',
                  content: new OA\JsonContent(
                      type: 'object',
          Severity: Minor
          Found in src/Controller/Api/Entry/DomainEntriesRetrieveApi.php - About 1 hr to fix

            Method favourited has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                #[OA\Response(
                    response: 200,
                    description: 'A paginated list of user\'s favourited posts',
                    content: new OA\JsonContent(
                        type: 'object',
            Severity: Minor
            Found in src/Controller/Api/Post/PostsRetrieveApi.php - About 1 hr to fix

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

                  public function unsubscribe(User $user): void
                  {
                      $criteria = Criteria::create()
                          ->where(Criteria::expr()->eq('user', $user));
              
              
              Severity: Major
              Found in src/Entity/Category.php and 2 other locations - About 1 hr to fix
              src/Entity/Domain.php on lines 117..131
              src/Entity/Magazine.php on lines 316..330

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

              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 unsubscribe(User $user): void
                  {
                      $criteria = Criteria::create()
                          ->where(Criteria::expr()->eq('user', $user));
              
              
              Severity: Major
              Found in src/Entity/Magazine.php and 2 other locations - About 1 hr to fix
              src/Entity/Category.php on lines 111..125
              src/Entity/Domain.php on lines 117..131

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

              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 unsubscribe(User $user): void
                  {
                      $criteria = Criteria::create()
                          ->where(Criteria::expr()->eq('user', $user));
              
              
              Severity: Major
              Found in src/Entity/Domain.php and 2 other locations - About 1 hr to fix
              src/Entity/Category.php on lines 111..125
              src/Entity/Magazine.php on lines 316..330

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

              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

              Consider simplifying this complex logical expression.
              Open

                          if ($parent instanceof Entry) {
                              $children = array_filter(
                                  $comments,
                                  fn ($val) => $val instanceof EntryComment && $val->entry === $parent
                              );
              Severity: Major
              Found in src/Kbin/SubjectOverviewListCreate.php - About 1 hr to fix

                Method __invoke has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        ClientManagerInterface $manager,
                        ClientFactory $clientFactory,
                        UserCreate $userCreate,
                        UserRepository $userRepository,
                        SettingsManager $settingsManager,
                Severity: Major
                Found in src/Controller/Api/OAuth2/CreateClientApi.php - About 1 hr to fix

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

                  <?php
                  
                  // SPDX-FileCopyrightText: 2023 /kbin contributors <https://kbin.pub/>
                  //
                  // SPDX-License-Identifier: AGPL-3.0-only
                  Severity: Minor
                  Found in src/Controller/Admin/AdminCategoryController.php and 1 other location - About 1 hr to fix
                  src/Controller/User/UserRemoveFollowing.php on lines 1..33

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

                  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

                  <?php
                  
                  // SPDX-FileCopyrightText: 2023 /kbin contributors <https://kbin.pub/>
                  //
                  // SPDX-License-Identifier: AGPL-3.0-only
                  Severity: Minor
                  Found in src/Controller/User/UserRemoveFollowing.php and 1 other location - About 1 hr to fix
                  src/Controller/Admin/AdminCategoryController.php on lines 1..35

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

                  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

                                  scrollingContainer.addEventListener('scroll', function(event){
                                      popoversArray.forEach(function(element){
                                          if(element.popoverIsOpen) element.togglePopover(false, false);
                                      });
                                  });
                  Severity: Minor
                  Found in assets/utils/popover.js and 1 other location - About 55 mins to fix
                  assets/utils/popover.js on lines 292..296

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

                  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

                          window.addEventListener('scroll', function(event){
                              popoversArray.forEach(function(element){
                                  if(element.popoverIsOpen) element.togglePopover(false, false);
                              });
                          });
                  Severity: Minor
                  Found in assets/utils/popover.js and 1 other location - About 55 mins to fix
                  assets/utils/popover.js on lines 301..305

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

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

                      public function handleImages(array $attachment): ?Image
                      {
                          $images = array_filter(
                              $attachment,
                              fn ($val) => \in_array($val['type'], ['Document', 'Image']) && ImageManager::isImageUrl($val['url'])
                  Severity: Minor
                  Found in src/Service/ActivityPubManager.php - About 55 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 notification has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      notification(data) {
                          if (data.detail.parentSubject && this.element.id === data.detail.parentSubject.htmlId) {
                              if (data.detail.op.endsWith('CommentDeletedNotification') || data.detail.op.endsWith('CommentCreatedNotification')) {
                                  this.updateCommentCounter(data);
                              }
                  Severity: Minor
                  Found in assets/controllers/subject_controller.js - About 55 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 uploadImage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      #[OA\Response(
                          response: 201,
                          description: 'Returns the created oauth2 client. Be sure to save the identifier and secret since these will be how you obtain tokens for the API.',
                          content: new Model(type: OAuth2ClientDto::class, groups: ['Default', 'created', 'common']),
                          headers: [
                  Severity: Minor
                  Found in src/Controller/Api/OAuth2/CreateClientApi.php - About 55 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 __invoke has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      #[OA\Response(
                          response: 200,
                          description: 'Returns a paginated list of content, along with any ActivityPub actors that matched the query by username, or ActivityPub objects that matched the query by URL. Actors and objects are not paginated',
                          content: new OA\JsonContent(
                              type: 'object',
                  Severity: Minor
                  Found in src/Controller/Api/Search/SearchRetrieveApi.php - About 55 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 __invoke has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      #[OA\Response(
                          response: 201,
                          description: 'Returns the created oauth2 client. Be sure to save the identifier and secret since these will be how you obtain tokens for the API.',
                          content: new Model(type: OAuth2ClientDto::class, groups: ['created', 'common']),
                          headers: [
                  Severity: Minor
                  Found in src/Controller/Api/OAuth2/CreateClientApi.php - About 55 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