pixelfed/pixelfed

View on GitHub

Showing 1,326 of 1,561 total issues

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

class ApiV1Controller extends Controller
{
    protected $fractal;

    const PF_API_ENTITY_KEY = '_pe';
Severity: Major
Found in app/Http/Controllers/Api/ApiV1Controller.php - About 1 day to fix

    Method timelineHome has 223 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function timelineHome(Request $request)
        {
            abort_if(! $request->user() || ! $request->user()->token(), 403);
            abort_unless($request->user()->tokenCan('read'), 403);
    
    
    Severity: Major
    Found in app/Http/Controllers/Api/ApiV1Controller.php - About 1 day to fix

      Method accountUpdateCredentials has 205 lines of code (exceeds 25 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: Major
      Found in app/Http/Controllers/Api/ApiV1Controller.php - About 1 day to fix

        Function FakeBlobBuilder has 200 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function FakeBlobBuilder () {
            function isDataView (obj) {
              return obj && DataView.prototype.isPrototypeOf(obj)
            }
            function bufferClone (buf) {
        Severity: Major
        Found in resources/assets/js/polyfill.js - About 1 day to fix

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

              protected function reportsHandleProfileAction($report, $action)
              {
                  switch ($action) {
                      case 'ignore':
                          Report::whereObjectId($report->object_id)
          Severity: Major
          Found in app/Http/Controllers/Admin/AdminReportController.php - About 7 hrs to fix

            Function checkPermissions has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function checkPermissions($request, $abortOnFail = true)
                {
                    $user = $request->user();
            
                    if($abortOnFail) {
            Severity: Minor
            Found in app/Http/Controllers/ImportPostController.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

            File activity-log.blade.php has 475 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <template v-if="loaded">
            @if($email_verified_at === null)
            <div class="alert alert-danger mb-3">
                <p class="mb-0 font-weight-bold">Applicant has not verified their email address yet, action can not be taken at this time.</p>
            </div>

              Function statusCreate has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function statusCreate(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 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

              File PortfolioController.php has 465 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              namespace App\Http\Controllers;
              
              use Illuminate\Http\Request;
              Severity: Minor
              Found in app/Http/Controllers/PortfolioController.php - About 7 hrs to fix

                Method statusCreate has 177 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function statusCreate(Request $request)
                    {
                        abort_if(! $request->user() || ! $request->user()->token(), 403);
                        abort_unless($request->user()->tokenCan('write'), 403);
                
                
                Severity: Major
                Found in app/Http/Controllers/Api/ApiV1Controller.php - About 7 hrs to fix

                  Method getData has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getData(Request $request)
                      {
                          abort_if(now()->gt('2021-03-01 00:00:00'), 404);
                          abort_if(config('database.default') != 'mysql', 404);
                  
                  
                  Severity: Major
                  Found in app/Http/Controllers/SeasonalController.php - About 6 hrs to fix

                    File StoryComposeController.php has 444 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace App\Http\Controllers;
                    
                    use App\DirectMessage;
                    Severity: Minor
                    Found in app/Http/Controllers/StoryComposeController.php - About 6 hrs to fix

                      File StoryApiV1Controller.php has 440 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace App\Http\Controllers\Stories;
                      
                      use App\DirectMessage;
                      Severity: Minor
                      Found in app/Http/Controllers/Stories/StoryApiV1Controller.php - About 6 hrs to fix

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

                        @extends('admin.partial.template-full')
                        
                        @section('section')
                        </div>
                        <div class="header bg-primary pb-2 mt-n4">
                        Severity: Minor
                        Found in resources/views/admin/home.blade.php - About 6 hrs to fix

                          Method reportsApiRemoteHandle has 157 lines of code (exceeds 25 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: Major
                          Found in app/Http/Controllers/Admin/AdminReportController.php - About 6 hrs to fix

                            Method settingsHomeStore has 156 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function settingsHomeStore(Request $request)
                                {
                                    $this->validate($request, [
                                        'name' => 'nullable|string',
                                        'short_description' => 'nullable',
                            Severity: Major
                            Found in app/Http/Controllers/Admin/AdminSettingsController.php - About 6 hrs to fix

                              Method statusFirstOrFetch has 155 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function statusFirstOrFetch($url, $replyTo = false)
                                  {
                                      $url = self::validateUrl($url);
                                      if ($url == false) {
                                          return;
                              Severity: Major
                              Found in app/Util/ActivityPub/Helpers.php - About 6 hrs to fix

                                Method userAdminAction has 154 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function userAdminAction(Request $request)
                                    {
                                        abort_if(!$request->user() || !$request->user()->token(), 404);
                                
                                        abort_unless($request->user()->is_admin == 1, 404);
                                Severity: Major
                                Found in app/Http/Controllers/Api/AdminApiController.php - About 6 hrs to fix

                                  File Installer.php has 423 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  
                                  namespace App\Console\Commands;
                                  
                                  use Illuminate\Console\Command;
                                  Severity: Minor
                                  Found in app/Console/Commands/Installer.php - About 6 hrs to fix

                                    Method modAction has 153 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function modAction(Request $request)
                                        {
                                            abort_unless(Auth::user()->is_admin, 400);
                                            $this->validate($request, [
                                                'action' => [
                                    Severity: Major
                                    Found in app/Http/Controllers/InternalApiController.php - About 6 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language