pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

Method directoryStore has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function directoryStore(Request $request)
    {
        $this->validate($request, [
            'location' => 'string|min:1|max:53',
            'summary' => 'string|nullable|max:140',
Severity: Major
Found in app/Http/Controllers/Admin/AdminDirectoryController.php - About 2 hrs to fix

    Method showEmbed has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function showEmbed(Request $request, $username, int $id)
        {
            if (! (bool) config_cache('instance.embed.post')) {
                $res = view('status.embed-removed');
    
    
    Severity: Major
    Found in app/Http/Controllers/StatusController.php - About 2 hrs to fix

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

          public function transform(Status $status)
          {
              $pid = request()->user()->profile_id;
              $taggedPeople = MediaTagService::get($status->id);
              $poll = $status->type === 'poll' ? PollService::get($status->id, $pid) : null;
      Severity: Major
      Found in app/Transformer/Api/StatusTransformer.php - About 2 hrs to fix

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

            public function handle()
            {
                $enabled = (bool) config_cache('pixelfed.cloud_storage');
                if(!$enabled) {
                    $this->error('Cloud storage not enabled. Exiting...');
        Severity: Major
        Found in app/Console/Commands/CloudMediaMigrate.php - About 2 hrs to fix

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

              public function handle()
              {
                  $old_memory_limit = ini_get('memory_limit');
                  ini_set('memory_limit', '256M');
                  $path = storage_path('app/cities.json');
          Severity: Major
          Found in app/Console/Commands/ImportCities.php - About 2 hrs to fix

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

                public function handle(): void
                {
                    if ($this->batch()->cancelled()) {
                        return;
                    }

              Method getVerifyCredentials has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getVerifyCredentials($key, $secret, $region, $bucket, $endpoint)
                  {
                      $client = new S3Client([
                          'version' => 'latest',
                          'region' => $region,
              Severity: Minor
              Found in app/Services/FilesystemService.php - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                            if(
                                !$json ||
                                !isset($json['id']) ||
                                !isset($json['type']) ||
                                $json['type'] !== 'Emoji' ||
                Severity: Critical
                Found in app/Services/CustomEmojiService.php - About 2 hrs to fix

                  Method getRequirements has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getRequirements()
                      {
                          abort_if(file_exists(base_path('.env')), 404);
                          $reqs = [];
                  
                  
                  Severity: Minor
                  Found in app/Http/Controllers/InstallController.php - About 2 hrs to fix

                    Method updateConfiguration has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function updateConfiguration(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 2 hrs to fix

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

                              for ($y = 0; $y < $height; ++$y) {
                                  $row = [];
                                  for ($x = 0; $x < $width; ++$x) {
                                      $index = imagecolorat($image, $x, $y);
                                      $colors = imagecolorsforindex($image, $index);
                      Severity: Major
                      Found in app/Util/Media/Blurhash.php and 1 other location - About 2 hrs to fix
                      app/Services/InstanceService.php on lines 112..121

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

                      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

                                  for ($y = 0; $y < $height; ++$y) {
                                      $row = [];
                                      for ($x = 0; $x < $width; ++$x) {
                                          $index = imagecolorat($image, $x, $y);
                                          $colors = imagecolorsforindex($image, $index);
                      Severity: Major
                      Found in app/Services/InstanceService.php and 1 other location - About 2 hrs to fix
                      app/Util/Media/Blurhash.php on lines 36..45

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

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

                        Method remoteAnnounceDeliver has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function remoteAnnounceDeliver()
                            {
                                if (config('app.env') !== 'production' || (bool) config_cache('federation.activitypub.enabled') == false) {
                                    $status->delete();
                        
                        
                        Severity: Minor
                        Found in app/Jobs/SharePipeline/UndoSharePipeline.php - About 1 hr to fix

                          Method getMastodon has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function getMastodon($id, $publicOnly = true)
                              {
                                  $status = self::get($id, $publicOnly, true);
                                  if(!$status) {
                                      return null;
                          Severity: Minor
                          Found in app/Services/StatusService.php - About 1 hr to fix

                            Method bookmarks has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function bookmarks(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 sessionValidateUsername has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function sessionValidateUsername(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 transform has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function transform(Status $status)
                                    {
                                        $taggedPeople = MediaTagService::get($status->id);
                                        $poll = $status->type === 'poll' ? PollService::get($status->id) : null;
                                        $rendered = config('exp.autolink') ?
                                Severity: Minor
                                Found in app/Transformer/Api/StatusStatelessTransformer.php - About 1 hr to fix

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

                                      protected function create()
                                      {
                                          $this->info('Create Invite');
                                          $this->line('=============');
                                          $this->info('Set an optional invite name (only visible to admins)');
                                  Severity: Minor
                                  Found in app/Console/Commands/AdminInviteCommand.php - About 1 hr to fix

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

                                        public function exportFollowing()
                                        {
                                            $data = Cache::remember('account:export:profile:following:'.Auth::user()->profile->id, now()->addMinutes(60), function() {
                                                return Auth::user()->profile->following()->get()->map(function($i) {
                                                    return $i->url();
                                    Severity: Major
                                    Found in app/Http/Controllers/Settings/ExportSettings.php and 1 other location - About 1 hr to fix
                                    app/Http/Controllers/Settings/ExportSettings.php on lines 65..77

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

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language