pixelfed/pixelfed

View on GitHub

Showing 1,329 of 1,562 total issues

Method run has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function run($query)
    {
        $this->query = $query;
        $q = urldecode($query->input('q'));

Severity: Minor
Found in app/Services/SearchApiV2Service.php - About 1 hr to fix

    Method cleanup has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function cleanup($avatar, $confirm = false)
        {
            if(!$avatar || !$confirm) {
                return;
            }
    Severity: Minor
    Found in app/Services/AvatarService.php - About 1 hr to fix

      Method toArray has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function toArray($request)
          {
              $status = $this;
              $taggedPeople = MediaTagService::get($status->id);
              $poll = $status->type === 'poll' ? PollService::get($status->id) : null;
      Severity: Minor
      Found in app/Http/Resources/StatusStateless.php - About 1 hr to fix

        Method accountFavourites has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function accountFavourites(Request $request)
            {
                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 1 hr to fix

          Method statusFavouriteById has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method apiUsernameCheck has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function apiUsernameCheck(Request $request)
                {
                    $this->validate($request, [
                        'token' => 'required',
                        'username' => 'required'
            Severity: Minor
            Found in app/Http/Controllers/AdminInviteController.php - About 1 hr to fix

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

                  public function handle()
                  {
                      $duplicates = DB::table('profiles')
                          ->whereNull('domain')
                          ->select('username', DB::raw('COUNT(*) as "count"'))
              Severity: Minor
              Found in app/Console/Commands/FixDuplicateProfiles.php - About 1 hr to fix

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

                    public function handle()
                    {
                        $this->info('Welcome to the avatar sync manager');
                        $this->line(' ');
                        $this->line(' ');
                Severity: Minor
                Found in app/Console/Commands/AvatarSync.php - About 1 hr to fix

                  Method fanoutDelete has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function fanoutDelete($status)
                      {
                          $profile = $status->profile;
                  
                          if (! $profile) {
                  Severity: Minor
                  Found in app/Jobs/StatusPipeline/StatusDelete.php - About 1 hr to fix

                    Method get has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function get()
                        {
                            $res = Cache::remember('api:nodeinfo', 900, function () {
                                $activeHalfYear = self::activeUsersHalfYear();
                                $activeMonth = self::activeUsersMonthly();
                    Severity: Minor
                    Found in app/Util/Site/Nodeinfo.php - About 1 hr to fix

                      Method getRssFeed has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getRssFeed(Request $request, $username)
                          {
                              $user = User::whereUsername($username)->first();
                      
                              if(!$user) {
                      Severity: Minor
                      Found in app/Http/Controllers/PortfolioController.php - About 1 hr to fix

                        Method storeReport has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function storeReport(Request $request)
                            {
                                abort_if(! (bool) config_cache('instance.stories.enabled') || ! $request->user(), 404);
                        
                                $this->validate($request, [
                        Severity: Minor
                        Found in app/Http/Controllers/StoryComposeController.php - About 1 hr to fix

                          Method modReportHandle has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

                            Method remoteDeliver has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function remoteDeliver($dm)
                                {
                                    $profile = $dm->author;
                                    $url = $dm->recipient->sharedInbox ?? $dm->recipient->inbox_url;
                            
                            
                            Severity: Minor
                            Found in app/Http/Controllers/DirectMessageController.php - About 1 hr to fix

                              Function decode has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function decode (string $blurhash, int $width, int $height, float $punch = 1.0, bool $linear = false): array {
                                      if (empty($blurhash) || strlen($blurhash) < 6) {
                                          throw new InvalidArgumentException("Blurhash string must be at least 6 characters");
                                      }
                              
                              
                              Severity: Minor
                              Found in app/Util/Blurhash/Blurhash.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 updateImmediateAttributes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function updateImmediateAttributes($status, $activity)
                                  {
                                      if (isset($activity['content'])) {
                                          $status->caption = strip_tags($activity['content']);
                                          $status->rendered = Purify::clean($activity['content']);
                              Severity: Minor
                              Found in app/Jobs/StatusPipeline/StatusRemoteUpdatePipeline.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 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function handle()
                                  {
                                      $username = $this->username;
                                      $headers = $this->headers;
                              
                              
                              Severity: Minor
                              Found in app/Jobs/InboxPipeline/InboxValidator.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 profileUpdateOrCreate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function profileUpdateOrCreate($url)
                                  {
                                      $res = self::fetchProfileFromUrl($url);
                                      if (! $res || isset($res['id']) == false) {
                                          return;
                              Severity: Minor
                              Found in app/Util/ActivityPub/Helpers.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 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function handle(): void
                                  {
                                      if(!config('exp.cached_home_timeline')) {
                                          return;
                                      }
                              Severity: Minor
                              Found in app/Jobs/HomeFeedPipeline/FeedRemoveDomainPipeline.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 importNoteAttachment has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function importNoteAttachment($data, Status $status)
                                  {
                                      if (self::verifyAttachments($data) == false) {
                                          // \Log::info('importNoteAttachment::failedVerification.', [$data['id']]);
                                          $status->viewType();
                              Severity: Minor
                              Found in app/Util/ActivityPub/Helpers.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

                              Severity
                              Category
                              Status
                              Source
                              Language