pixelfed/pixelfed

View on GitHub

Showing 1,326 of 1,561 total issues

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

<?php

namespace App\Http\Controllers\Api;

use App\Avatar;
Severity: Major
Found in app/Http/Controllers/Api/ApiV1Controller.php - About 1 wk to fix

    File AdminReportController.php has 1282 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace App\Http\Controllers\Admin;
    
    use App\AccountInterstitial;
    Severity: Major
    Found in app/Http/Controllers/Admin/AdminReportController.php - About 3 days to fix

      File Inbox.php has 1135 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

        File home.blade.php has 888 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        @extends('admin.partial.template-full')
        
        @section('section')
        <div class="title mb-4">
            <h3 class="font-weight-bold">Diagnostics</h3>
        Severity: Major
        Found in resources/views/admin/diagnostics/home.blade.php - About 2 days to fix

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

            <?php
            
            namespace App\Http\Controllers\Admin;
            
            use App\Models\ConfigCache;
            Severity: Major
            Found in app/Http/Controllers/Admin/AdminSettingsController.php - About 1 day to fix

              File ApiV1Dot1Controller.php has 766 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                File AdminApiController.php has 726 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/AdminApiController.php - About 1 day to fix

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

                  <?php
                  
                  namespace App\Util\ActivityPub;
                  
                  use App\Instance;
                  Severity: Major
                  Found in app/Util/ActivityPub/Helpers.php - About 1 day to fix

                    File PublicApiController.php has 705 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

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

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

                        Function accountUpdateCredentials has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function accountUpdateCredentials(Request $request)
                            {
                                abort_if(! $request->user() || ! $request->user()->token(), 403);
                                abort_unless($request->user()->tokenCan('write'), 403);
                        
                        
                        Severity: Minor
                        Found in app/Http/Controllers/Api/ApiV1Controller.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 resolveQuery has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function resolveQuery()
                            {
                                $default = [
                                    'accounts' => [],
                                    'hashtags' => [],
                        Severity: Minor
                        Found in app/Services/SearchApiV2Service.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 statusFirstOrFetch has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function statusFirstOrFetch($url, $replyTo = false)
                            {
                                $url = self::validateUrl($url);
                                if ($url == false) {
                                    return;
                        Severity: Minor
                        Found in app/Util/ActivityPub/Helpers.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 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 RemoteAuthController.php has 605 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

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

                            Function reportsApiRemoteHandle has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function reportsApiRemoteHandle(Request $request)
                                {
                                    $this->validate($request, [
                                        'id' => 'required|exists:remote_reports,id',
                                        'action' => 'required|in:mark-read,cw-posts,unlist-posts,delete-posts,private-posts,mark-all-read-by-domain,mark-all-read-by-username,cw-all-posts,private-all-posts,unlist-all-posts'
                            Severity: Minor
                            Found in app/Http/Controllers/Admin/AdminReportController.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 moderatePost has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function moderatePost(Request $request, $id)
                                {
                                    abort_if(!$request->user() || !$request->user()->token(), 403);
                                    abort_if($request->user()->is_admin != true, 403);
                                    abort_unless($request->user()->tokenCan('admin:write'), 403);
                            Severity: Minor
                            Found in app/Http/Controllers/Api/ApiV1Dot1Controller.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 browse has 253 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 AccountController.php has 570 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              
                              namespace App\Http\Controllers;
                              
                              use Auth;
                              Severity: Major
                              Found in app/Http/Controllers/AccountController.php - About 1 day to fix
                                Severity
                                Category
                                Status
                                Source
                                Language