pixelfed/pixelfed

View on GitHub

Showing 1,326 of 1,561 total issues

Method validate has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function validate($payload)
    {
        $valid = Validator::make($payload, [
            '@context' => 'required',
            'id' => 'required|string|url',
Severity: Major
Found in app/Util/ActivityPub/Validator/UpdatePersonValidator.php - About 3 hrs to fix

    Method inAppRegistration has 90 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function inAppRegistration(Request $request)
        {
            abort_if($request->user(), 404);
            abort_unless((bool) config_cache('pixelfed.open_registration'), 404);
            abort_unless((bool) config_cache('pixelfed.allow_app_registration'), 404);
    Severity: Major
    Found in app/Http/Controllers/Api/ApiV1Dot1Controller.php - About 3 hrs to fix

      Method mediaUpload has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function mediaUpload(Request $request)
          {
              $this->validate($request, [
                  'file'      => function() {
                      return [
      Severity: Major
      Found in app/Http/Controllers/DirectMessageController.php - About 3 hrs to fix

        Method transform has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function transform(Status $status)
            {
                $mentions = $status->mentions->map(function ($mention) {
                    $webfinger = $mention->emailUrl();
                    $name = Str::startsWith($webfinger, '@') ?
        Severity: Major
        Found in app/Transformer/ActivityPub/Verb/Question.php - About 3 hrs to fix

          Function settingsApiUpdateUsersType has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function settingsApiUpdateUsersType($request)
              {
                  $this->validate($request, [
                      'require_email_verification' => 'required',
                      'enforce_account_limit' => 'required',
          Severity: Minor
          Found in app/Http/Controllers/Admin/AdminSettingsController.php - About 3 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

          Function accountFollowingById has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function accountFollowingById(Request $request, $id)
              {
                  abort_if(! $request->user() || ! $request->user()->token(), 403);
                  abort_unless($request->user()->tokenCan('read'), 403);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Api/ApiV1Controller.php - About 3 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

          Function accountFollowersById has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function accountFollowersById(Request $request, $id)
              {
                  abort_if(! $request->user() || ! $request->user()->token(), 403);
                  abort_unless($request->user()->tokenCan('read'), 403);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Api/ApiV1Controller.php - About 3 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

          Function regularMode has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function regularMode($minId, $limit, $log)
              {
                  $gc = Media::whereRemoteMedia(false)
                      ->whereNotNull(['status_id', 'cdn_url', 'replicated_at'])
                      ->whereNot('version', '4')
          Severity: Minor
          Found in app/Console/Commands/MediaS3GarbageCollector.php - About 3 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

          Method handleImageTransform has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function handleImageTransform(Media $media, $thumbnail = false)
              {
                  $path = $media->media_path;
                  $file = storage_path('app/'.$path);
                  if (!in_array($media->mime, $this->acceptedMimes)) {
          Severity: Major
          Found in app/Util/Media/Image.php - About 3 hrs to fix

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

            @extends('admin.partial.template-full')
            
            @section('section')
            <div class="title">
                <h3 class="font-weight-bold d-inline-block">Profiles</h3>
            Severity: Minor
            Found in resources/views/admin/profiles/home.blade.php - About 3 hrs to fix

              File Profile.php has 315 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              namespace App;
              
              use Auth, Cache, DB, Storage;
              Severity: Minor
              Found in app/Profile.php - About 3 hrs to fix

                File ProfileController.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace App\Http\Controllers;
                
                use App\AccountInterstitial;
                Severity: Minor
                Found in app/Http/Controllers/ProfileController.php - About 3 hrs to fix

                  Method create has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function create(Request $request)
                      {
                          $this->validate($request, [
                              'to_id' => 'required',
                              'message' => 'required|string|min:1|max:500',
                  Severity: Major
                  Found in app/Http/Controllers/DirectMessageController.php - About 3 hrs to fix

                    Function handleUndoActivity has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function handleUndoActivity()
                        {
                            $actor = $this->payload['actor'];
                            $profile = self::actorFirstOrCreate($actor);
                            $obj = $this->payload['object'];
                    Severity: Minor
                    Found in app/Util/ActivityPub/Inbox.php - About 3 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

                    Method accountStatusesById has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function accountStatusesById(Request $request, $id)
                        {
                            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 3 hrs to fix

                      Method handle has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function handle()
                          {
                              if(config('filesystems.default') !== 'local') {
                                  $this->error('Invalid default filesystem, set FILESYSTEM_DRIVER=local to proceed');
                                  return Command::SUCCESS;
                      Severity: Major
                      Found in app/Console/Commands/FixMediaDriver.php - About 3 hrs to fix

                        Method storeStatus has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function storeStatus($url, $profile, $activity)
                            {
                                $originalUrl = $url;
                                $id = isset($activity['id']) ? self::pluckval($activity['id']) : self::pluckval($activity['url']);
                                $url = isset($activity['url']) && is_string($activity['url']) ? self::pluckval($activity['url']) : self::pluckval($id);
                        Severity: Major
                        Found in app/Util/ActivityPub/Helpers.php - About 3 hrs to fix

                          Method handle has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function handle()
                              {
                                  $user = $this->user;
                                  $profile = $user->profile;
                                  $id = $user->profile_id;
                          Severity: Major
                          Found in app/Jobs/DeletePipeline/DeleteAccountPipeline.php - About 3 hrs to fix

                            Method spam has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function spam(Request $request)
                                {
                                    $this->validate($request, [
                                        'tab' => 'sometimes|in:home,not-spam,spam,settings,custom,exemptions',
                                    ]);
                            Severity: Major
                            Found in app/Http/Controllers/Admin/AdminReportController.php - About 3 hrs to fix

                              Method handle has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function handle()
                                  {
                                      if(!$this->confirm('Are you sure you want to run the fix status command?')) {
                                          return;
                                      }
                              Severity: Major
                              Found in app/Console/Commands/FixStatusCount.php - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language