pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

Method blindKeyRotation has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function blindKeyRotation($headers, $payload)
    {
        $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
        $date = is_array($headers['date']) ? $headers['date'][0] : $headers['date'];
        if(!$signature) {
Severity: Minor
Found in app/Jobs/InboxPipeline/DeleteWorker.php - About 1 hr to fix

    Method blindKeyRotation has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function blindKeyRotation($headers, $payload)
        {
            $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
            $date = is_array($headers['date']) ? $headers['date'][0] : $headers['date'];
            if(!$signature) {
    Severity: Minor
    Found in app/Jobs/InboxPipeline/InboxWorker.php - About 1 hr to fix

      Method directoryHandleServerSubmission has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function directoryHandleServerSubmission(Request $request)
          {
              $reqs = [];
              $reqs['feature_config'] = [
                  'open_registration' => (bool) config_cache('pixelfed.open_registration'),
      Severity: Minor
      Found in app/Http/Controllers/Admin/AdminDirectoryController.php - About 1 hr to fix

        Method show has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function show(Request $request, $username, $id)
            {
                // redirect authed users to Metro 2.0
                if ($request->user()) {
                    // unless they force static view
        Severity: Minor
        Found in app/Http/Controllers/StatusController.php - About 1 hr to fix

          Method store has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function store(Request $request)
              {
                  $this->validate($request, [
                      'item'    => 'required|integer|min:1',
                  ]);
          Severity: Minor
          Found in app/Http/Controllers/LikeController.php - About 1 hr to fix

            Method trendingApi has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function trendingApi(Request $request)
                {
                    abort_if(config('instance.discover.public') == false && ! $request->user(), 403);
            
                    $this->validate($request, [
            Severity: Minor
            Found in app/Http/Controllers/DiscoverController.php - About 1 hr to fix

              Method statusComments has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function statusComments(Request $request, $username, int $postId)
                  {
                      $this->validate($request, [
                          'min_id'    => 'nullable|integer|min:1',
                          'max_id'    => 'nullable|integer|min:1|max:'.PHP_INT_MAX,
              Severity: Minor
              Found in app/Http/Controllers/PublicApiController.php - About 1 hr to fix

                Method hugeMode has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function hugeMode($minId, $limit, $log)
                    {
                        $cloudDisk = Storage::disk(config('filesystems.cloud'));
                        $localDisk = Storage::disk('local');
                
                
                Severity: Minor
                Found in app/Console/Commands/MediaS3GarbageCollector.php - About 1 hr to fix

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

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

                            if($collection['published_at'] == null || $collection['visibility'] != 'public') {
                                abort_unless($user, 404);
                                if($user->profile_id != $collection['pid']) {
                                    if(!$user->is_admin) {
                                        abort_if($collection['visibility'] != 'private', 404);
                    Severity: Major
                    Found in app/Http/Controllers/CollectionController.php and 1 other location - About 1 hr to fix
                    app/Http/Controllers/CollectionController.php on lines 187..195

                    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 117.

                    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

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

                            if($collection['published_at'] == null || $collection['visibility'] != 'public') {
                                abort_unless($user, 404);
                                if($user->profile_id != $collection['pid']) {
                                    if(!$user->is_admin) {
                                        abort_if($collection['visibility'] != 'private', 404);
                    Severity: Major
                    Found in app/Http/Controllers/CollectionController.php and 1 other location - About 1 hr to fix
                    app/Http/Controllers/CollectionController.php on lines 209..217

                    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 117.

                    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 updateMedia has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function updateMedia($status, $activity)
                        {
                            if (! isset($activity['attachment'])) {
                                return;
                            }
                    Severity: Minor
                    Found in app/Jobs/StatusPipeline/StatusRemoteUpdatePipeline.php - About 1 hr to fix

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

                          protected function fanoutExpiry()
                          {
                              $story = $this->story;
                              $profile = $story->profile;
                      
                      
                      Severity: Minor
                      Found in app/Jobs/StoryPipeline/StoryExpire.php - About 1 hr to fix

                        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 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 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 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 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 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 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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language