pixelfed/pixelfed

View on GitHub

Showing 1,326 of 1,561 total issues

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

    public function transform(Status $status)
    {
        return [
            '@context' => [
                'https://w3id.org/security/v1',
Severity: Minor
Found in app/Transformer/ActivityPub/Verb/CreateQuestion.php - About 1 hr to fix

    Method accountToId has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function accountToId(Request $request)
        {
            abort_unless((
                config_cache('pixelfed.open_registration') &&
                config('remote-auth.mastodon.enabled')
    Severity: Minor
    Found in app/Http/Controllers/RemoteAuthController.php - About 1 hr to fix

      Method sessionCheck has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function sessionCheck(Request $request)
          {
              abort_unless((
                  config_cache('pixelfed.open_registration') &&
                  config('remote-auth.mastodon.enabled')
      Severity: Minor
      Found in app/Http/Controllers/RemoteAuthController.php - About 1 hr to fix

        Function handle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function handle()
            {
                $status = $this->status;
                $actor = $status->profile;
                $reply = Status::find($status->in_reply_to_id);
        Severity: Minor
        Found in app/Jobs/StatusPipeline/StatusReplyPipeline.php - About 1 hr 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 handle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function handle(): void
            {
                if ($this->batch()->cancelled()) {
                    return;
                }
        Severity: Minor
        Found in app/Jobs/ProfilePipeline/ProfilePurgeFollowersByDomain.php - About 1 hr 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 fetchAvatar has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function fetchAvatar($avatar, $local = false, $skipRecentCheck = false)
            {
                $queue = random_int(1, 15) > 5 ? 'mmo' : 'low';
                $url = $avatar->remote_url;
                $driver = $local ? 'local' : config('filesystems.cloud');
        Severity: Minor
        Found in app/Services/MediaStorageService.php - About 1 hr 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 fixUncategorizedSpam has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function fixUncategorizedSpam(Request $request)
            {
                if (Cache::get('admin-dash:reports:spam-sync-active')) {
                    return redirect('/i/admin/reports/autospam');
                }
        Severity: Minor
        Found in app/Http/Controllers/Admin/AdminReportController.php - About 1 hr 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 create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function create(Request $request)
            {
                $this->validate($request, [
                    'to_id' => 'required',
                    'message' => 'required|string|min:1|max:500',
        Severity: Minor
        Found in app/Http/Controllers/DirectMessageController.php - About 1 hr 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 handle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function handle(): void
            {
                $this->info('       ____  _           ______         __  ');
                $this->info('      / __ \(_)  _____  / / __/__  ____/ /  ');
                $this->info('     / /_/ / / |/_/ _ \/ / /_/ _ \/ __  /   ');
        Severity: Minor
        Found in app/Console/Commands/AvatarStorageDeepClean.php - About 1 hr 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 handle has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function handle()
            {
                if ((bool) config_cache('pixelfed.cloud_storage') == false) {
                    // Only run if cloud storage is enabled
                    return;
        Severity: Minor
        Found in app/Jobs/MediaPipeline/MediaFixLocalFilesystemCleanupPipeline.php - About 1 hr to fix

          Method storePoll has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function storePoll($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id)
              {
                  if (! isset($res['endTime']) || ! isset($res['oneOf']) || ! is_array($res['oneOf']) || count($res['oneOf']) > 4) {
                      return;
                  }
          Severity: Minor
          Found in app/Util/ActivityPub/Helpers.php - About 1 hr to fix

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

                public function handle()
                {
                    $profile = $this->profile;
            
                    if ((bool) config_cache('pixelfed.cloud_storage') == false && (bool) config_cache('federation.avatars.store_local') == false) {
            Severity: Minor
            Found in app/Jobs/AvatarPipeline/RemoteAvatarFetch.php - About 1 hr to fix

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

                  public function handle()
                  {
                      $media = $this->media;
                      if($media->mime != 'video/mp4') {
                          return;
              Severity: Minor
              Found in app/Jobs/VideoPipeline/VideoThumbnail.php - About 1 hr to fix

                Method createPoll has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function createPoll(Request $request)
                    {
                        $this->validate($request, [
                            'caption' => 'nullable|string|max:'.config_cache('pixelfed.max_caption_length', 500),
                            'cw' => 'nullable|boolean',
                Severity: Minor
                Found in app/Http/Controllers/ComposeController.php - About 1 hr to fix

                  Method settingsApiUpdateType has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function settingsApiUpdateType(Request $request, $type)
                      {
                          abort_unless(in_array($type, [
                              'posts',
                              'platform',
                  Severity: Minor
                  Found in app/Http/Controllers/Admin/AdminSettingsController.php - About 1 hr to fix

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

                        protected function getData()
                        {
                            $contact = Cache::remember('api:v1:instance:contact', now()->addMinutes(1440), function() {
                                $admin = User::whereIsAdmin(true)->first()->profile;
                                return [
                    Severity: Minor
                    Found in app/Http/Controllers/Api/InstanceApiController.php - About 1 hr to fix

                      Method index has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function index(Request $request)
                          {
                              $this->validate($request, [
                                  'filter' => 'sometimes|in:open,all,awaiting,approved,rejected,responses',
                                  'sort' => 'sometimes|in:asc,desc',
                      Severity: Minor
                      Found in app/Http/Controllers/AdminCuratedRegisterController.php - About 1 hr to fix

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

                            public function transform(Notification $notification)
                            {
                                $res = [
                                    'id' => (string) $notification->id,
                                    'type' => $this->replaceTypeVerb($notification->action),
                        Severity: Minor
                        Found in app/Transformer/Api/NotificationTransformer.php - About 1 hr to fix

                          Method scopeToAudience has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function scopeToAudience($audience)
                              {
                                  if(!in_array($audience, ['to', 'cc']) || $this->local == false) { 
                                      return;
                                  }
                          Severity: Minor
                          Found in app/Status.php - About 1 hr to fix

                            Method handlePollVote has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function handlePollVote()
                                {
                                    $activity = $this->payload['object'];
                                    $actor = $this->actorFirstOrCreate($this->payload['actor']);
                            
                            
                            Severity: Minor
                            Found in app/Util/ActivityPub/Inbox.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language