pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

Method handleNoteCreate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handleNoteCreate()
    {
        $activity = $this->payload['object'];
        $actor = $this->actorFirstOrCreate($this->payload['actor']);
        if(!$actor || $actor->domain == null) {
Severity: Minor
Found in app/Util/ActivityPub/Inbox.php - About 1 hr to fix

    Method postsGraph has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected static function postsGraph()
        {
            $ttl = now()->addHours(12);
            return Cache::remember('admin:dashboard:home:data-postsGraph:v0.1:24hr', $ttl, function() {
                $gb = config('database.default') == 'pgsql' ? ['statuses.id', 'created_at'] : DB::raw('Date(created_at)');
    Severity: Minor
    Found in app/Services/AdminStatsService.php - About 1 hr to fix

      Method handle has 37 lines of code (exceeds 25 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

        Method mediaUpdate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method buildPath has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function buildPath($id)
              {
                  $padded = str_pad($id, 19, 0, STR_PAD_LEFT);
                  $parts = str_split($padded, 3);
                  foreach ($parts as $k => $part) {
          Severity: Minor
          Found in app/Http/Controllers/AvatarController.php - About 1 hr to fix

            Method conciergeFormStore has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function conciergeFormStore(Request $request)
                {
                    abort_if($request->user(), 404);
                    $request->session()->increment('cur-reg-con-attempt');
                    abort_unless(
            Severity: Minor
            Found in app/Http/Controllers/CuratedRegisterController.php - About 1 hr to fix

              Method uploadAvatarsToCloud has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function uploadAvatarsToCloud()
                  {
                      if(!(bool) config_cache('pixelfed.cloud_storage') || !config('instance.avatar.local_to_cloud')) {
                          $this->error('Enable cloud storage and avatar cloud storage to perform this action');
                          return;
              Severity: Minor
              Found in app/Console/Commands/AvatarStorage.php - About 1 hr to fix

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

                    public function handle()
                    {
                        $tag = $this->argument('tag');
                        $hashtag = Hashtag::whereName($tag)->orWhere('slug', $tag)->first();
                        if(!$hashtag) {
                Severity: Minor
                Found in app/Console/Commands/HashtagRelatedGenerate.php - About 1 hr to fix

                  Method getAudience has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getAudience($scope = false)
                      {
                          if($this->remote_url) {
                              return [];
                          }
                  Severity: Minor
                  Found in app/Profile.php - About 1 hr to fix

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

                        public function handle()
                        {
                            $this->info('Running avatar migration...');
                            $count = Avatar::whereChangeCount(0)->count();
                    
                    
                    Severity: Minor
                    Found in app/Console/Commands/AvatarDefaultMigration.php - About 1 hr to fix

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if (! $actorProfileSync) {
                                  FollowServiceWarmCache::dispatch($actor)->onQueue('low');
                              } else {
                                  if ($actorProfile->following_count) {
                                      $actorProfile->decrement('following_count');
                      Severity: Major
                      Found in app/Jobs/FollowPipeline/UnfollowPipeline.php and 1 other location - About 1 hr to fix
                      app/Jobs/FollowPipeline/UnfollowPipeline.php on lines 78..90

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 110.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              if (! $targetProfileSync) {
                                  FollowServiceWarmCache::dispatch($target)->onQueue('low');
                              } else {
                                  if ($targetProfile->followers_count) {
                                      $targetProfile->decrement('followers_count');
                      Severity: Major
                      Found in app/Jobs/FollowPipeline/UnfollowPipeline.php and 1 other location - About 1 hr to fix
                      app/Jobs/FollowPipeline/UnfollowPipeline.php on lines 63..75

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 110.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Method fanoutExpiry has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function fanoutExpiry($profile, $activity)
                          {
                              $audience = FollowerService::softwareAudience($profile->id, 'pixelfed');
                      
                              if(empty($audience)) {
                      Severity: Minor
                      Found in app/Jobs/StoryPipeline/StoryDelete.php - About 1 hr to fix

                        Method importActivity has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function importActivity($activity)
                            {
                                $profile = $this->profile;
                                $supported = $this->supported;
                                $attachments = $activity['object']['attachment'];
                        Severity: Minor
                        Found in app/Jobs/RemoteFollowPipeline/RemoteFollowImportRecent.php - About 1 hr to fix

                          Method warmCache has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function warmCache($id, $force = false, $limit = 100, $returnIds = false)
                              {
                                  if(self::count($id) == 0 || $force == true) {
                                      Redis::del(self::CACHE_KEY . $id);
                                      $following = Cache::remember('profile:following:'.$id, 1209600, function() use($id) {
                          Severity: Minor
                          Found in app/Services/HomeTimelineService.php - About 1 hr to fix

                            Method getApFeed has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getApFeed(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 inviteRegisterStore has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function inviteRegisterStore(Request $request, $id, $code)
                                  {
                                      if($request->user()) {
                                          $title = 'You cannot complete this action on this device.';
                                          $body = 'Please log out or use a different device or browser to complete the invitation registration.';
                              Severity: Minor
                              Found in app/Http/Controllers/ParentalControlsController.php - About 1 hr to fix

                                Method getSettings has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function getSettings(Request $request)
                                    {
                                        abort_if(!$request->user(), 403);
                                
                                        $res = Portfolio::whereUserId($request->user()->id)->get();
                                Severity: Minor
                                Found in app/Http/Controllers/PortfolioController.php - About 1 hr to fix

                                  Method modReports has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function modReports(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 statusShare has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function statusShare(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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language