pixelfed/pixelfed

View on GitHub

Showing 612 of 615 total issues

File ApiV1Controller.php has 1460 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
Severity: Major
Found in app/Http/Controllers/Api/ApiV1Controller.php - About 3 days to fix

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

        public function handleStoryReactionActivity()
        {
            if(!isset(
                $this->payload['actor'],
                $this->payload['id'],
    Severity: Major
    Found in app/Util/ActivityPub/Inbox.php and 1 other location - About 3 days to fix
    app/Util/ActivityPub/Inbox.php on lines 896..990

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

    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 handleStoryReplyActivity()
        {
            if(!isset(
                $this->payload['actor'],
                $this->payload['id'],
    Severity: Major
    Found in app/Util/ActivityPub/Inbox.php and 1 other location - About 3 days to fix
    app/Util/ActivityPub/Inbox.php on lines 800..894

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

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

        protected function verifySignature($headers, $payload)
        {
            $body = $this->payload;
            $bodyDecoded = $payload;
            $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
    Severity: Major
    Found in app/Jobs/InboxPipeline/DeleteWorker.php and 1 other location - About 2 days to fix
    app/Jobs/InboxPipeline/InboxWorker.php on lines 131..183

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

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

        protected function verifySignature($headers, $payload)
        {
            $body = $this->payload;
            $bodyDecoded = $payload;
            $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
    Severity: Major
    Found in app/Jobs/InboxPipeline/InboxWorker.php and 1 other location - About 2 days to fix
    app/Jobs/InboxPipeline/DeleteWorker.php on lines 133..185

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

    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 Inbox.php has 835 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace App\Util\ActivityPub;
    
    use Cache, DB, Log, Purify, Redis, Storage, Validator;
    Severity: Major
    Found in app/Util/ActivityPub/Inbox.php - About 2 days to fix

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

          public function statusFavouritedBy(Request $request, $id)
          {
              abort_if(!$request->user(), 403);
      
              $this->validate($request, [
      Severity: Major
      Found in app/Http/Controllers/Api/ApiV1Controller.php and 1 other location - About 1 day to fix
      app/Http/Controllers/Api/ApiV1Controller.php on lines 1631..1663

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

      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 statusRebloggedBy(Request $request, $id)
          {
              abort_if(!$request->user(), 403);
      
              $this->validate($request, [
      Severity: Major
      Found in app/Http/Controllers/Api/ApiV1Controller.php and 1 other location - About 1 day to fix
      app/Http/Controllers/Api/ApiV1Controller.php on lines 1672..1704

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

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

          protected function blindKeyRotation($headers, $payload)
          {
              $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
              $date = is_array($headers['date']) ? $headers['date'][0] : $headers['date'];
              if(!$signature) {
      Severity: Major
      Found in app/Jobs/InboxPipeline/DeleteWorker.php and 1 other location - About 1 day to fix
      app/Jobs/InboxPipeline/InboxWorker.php on lines 185..220

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

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

          protected function blindKeyRotation($headers, $payload)
          {
              $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
              $date = is_array($headers['date']) ? $headers['date'][0] : $headers['date'];
              if(!$signature) {
      Severity: Major
      Found in app/Jobs/InboxPipeline/InboxWorker.php and 1 other location - About 1 day to fix
      app/Jobs/InboxPipeline/DeleteWorker.php on lines 187..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 371.

      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 DirectMessageController.php has 712 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace App\Http\Controllers;
      
      use Auth, Cache;
      Severity: Major
      Found in app/Http/Controllers/DirectMessageController.php - About 1 day to fix

        File PublicApiController.php has 673 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace App\Http\Controllers;
        
        use Illuminate\Http\Request;
        Severity: Major
        Found in app/Http/Controllers/PublicApiController.php - About 1 day to fix

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

              public function accountFollowersById(Request $request, $id)
              {
                  abort_if(!$request->user(), 403);
          
                  $user = $request->user();
          Severity: Major
          Found in app/Http/Controllers/Api/ApiV1Controller.php and 1 other location - About 1 day to fix
          app/Http/Controllers/Api/ApiV1Controller.php on lines 257..291

          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

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

              public function accountFollowingById(Request $request, $id)
              {
                  abort_if(!$request->user(), 403);
          
                  $user = $request->user();
          Severity: Major
          Found in app/Http/Controllers/Api/ApiV1Controller.php and 1 other location - About 1 day to fix
          app/Http/Controllers/Api/ApiV1Controller.php on lines 216..248

          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

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

                      Route::group(['prefix' => 'v1'], function() {
                          Route::get('accounts/verify_credentials', 'ApiController@verifyCredentials');
                          Route::get('accounts/relationships', 'Api\ApiV1Controller@accountRelationshipsById');
                          Route::get('accounts/search', 'Api\ApiV1Controller@accountSearch');
                          Route::get('accounts/{id}/statuses', 'PublicApiController@accountStatuses');
          Severity: Major
          Found in routes/web.php and 1 other location - About 1 day to fix
          routes/web.php on lines 187..211

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

          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

                      Route::group(['prefix' => 'v2'], function() {
                          Route::get('config', 'ApiController@siteConfiguration');
                          Route::get('discover', 'InternalApiController@discover');
                          Route::get('discover/posts', 'InternalApiController@discoverPosts');
                          Route::get('discover/profiles', 'DiscoverController@profilesDirectoryApi');
          Severity: Major
          Found in routes/web.php and 1 other location - About 1 day to fix
          routes/web.php on lines 161..185

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

          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 polyfill.js has 634 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* Blob.js
           * A Blob, File, FileReader & URL implementation.
           * 2019-04-19
           *
           * By Eli Grey, http://eligrey.com
          Severity: Major
          Found in resources/assets/js/polyfill.js - About 1 day to fix

            File ComposeController.php has 610 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace App\Http\Controllers;
            
            use Illuminate\Http\Request;
            Severity: Major
            Found in app/Http/Controllers/ComposeController.php - About 1 day to fix

              Method browse has 249 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function browse(Request $request)
                  {
                      $this->validate($request, [
                          'a' => 'nullable|string|in:inbox,sent,filtered',
                          'page' => 'nullable|integer|min:1|max:99'
              Severity: Major
              Found in app/Http/Controllers/DirectMessageController.php - About 1 day to fix

                File Helpers.php has 542 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace App\Util\ActivityPub;
                
                use DB, Cache, Purify, Storage, Request, Validator;
                Severity: Major
                Found in app/Util/ActivityPub/Helpers.php - About 1 day to fix
                  Severity
                  Category
                  Status
                  Source
                  Language