pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

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()
        {
            $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 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 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 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

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

                        public function __construct($user)
                        {
                            $avatar = $user ? $user->avatarUrl() : url('/storage/avatars/default.jpg');
                            $avatarPath = parse_url($avatar, PHP_URL_PATH);
                            $extension = pathinfo($avatarPath, PATHINFO_EXTENSION);
                    Severity: Minor
                    Found in app/Util/Webfinger/Webfinger.php - About 1 hr to fix

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

                          public function settingsApiUpdateHomeType($request)
                          {
                              $this->validate($request, [
                                  'registration_status' => 'required|in:open,filtered,closed',
                                  'cloud_storage' => 'required',
                      Severity: Minor
                      Found in app/Http/Controllers/Admin/AdminSettingsController.php - About 1 hr to fix

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

                            public function accountFollowRequestAccept(Request $request, $id)
                            {
                                abort_if(! $request->user() || ! $request->user()->token(), 403);
                                abort_unless($request->user()->tokenCan('follow'), 403);
                        
                        
                        Severity: Minor
                        Found in app/Http/Controllers/Api/ApiV1Controller.php - About 1 hr to fix

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

                              public function accountMutes(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 instagramStepOneStore has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function instagramStepOneStore(Request $request, $uuid)
                                {
                                    if((bool) config_cache('pixelfed.import.instagram.enabled') != true) {
                                        abort(404, 'Feature not enabled');
                                    }
                            Severity: Minor
                            Found in app/Http/Controllers/Import/Instagram.php - About 1 hr to fix

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

                                  public function store(Request $request)
                                  {
                                      $rules = [
                                          'username' => 'required|min:2|max:15|exists:users'
                                      ];
                              Severity: Minor
                              Found in app/Http/Controllers/UserEmailForgotController.php - About 1 hr to fix

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

                                    public function transform(Status $status)
                                    {
                                        return [
                                          '@context' => [
                                            'https://www.w3.org/ns/activitystreams',
                                Severity: Minor
                                Found in app/Transformer/ActivityPub/StatusTransformer.php - About 1 hr to fix

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

                                          if($status->in_reply_to_id != null) {
                                              $parent = $status->parent()->profile;
                                              if($parent) {
                                                  $webfinger = $parent->emailUrl();
                                                  $name = Str::startsWith($webfinger, '@') ?
                                  Severity: Major
                                  Found in app/Transformer/ActivityPub/Verb/UpdateNote.php and 1 other location - About 1 hr to fix
                                  app/Transformer/ActivityPub/Verb/CreateNote.php on lines 26..40

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

                                  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 (is_array($data['cc']) && ! empty($data['cc'])) {
                                              foreach ($data['cc'] as $cc) {
                                                  if ($cc == 'https://www.w3.org/ns/activitystreams#Public') {
                                                      $scope = 'unlisted';
                                  
                                  
                                  Severity: Major
                                  Found in app/Util/ActivityPub/Helpers.php and 1 other location - About 1 hr to fix
                                  app/Util/ActivityPub/Helpers.php on lines 116..128

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

                                  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($status->in_reply_to_id != null) {
                                              $parent = $status->parent()->profile;
                                              if($parent) {
                                                  $webfinger = $parent->emailUrl();
                                                  $name = Str::startsWith($webfinger, '@') ? 
                                  Severity: Major
                                  Found in app/Transformer/ActivityPub/Verb/CreateNote.php and 1 other location - About 1 hr to fix
                                  app/Transformer/ActivityPub/Verb/UpdateNote.php on lines 26..40

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

                                  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 (is_array($data['to']) && ! empty($data['to'])) {
                                              foreach ($data['to'] as $to) {
                                                  if ($to == 'https://www.w3.org/ns/activitystreams#Public') {
                                                      $scope = 'public';
                                  
                                  
                                  Severity: Major
                                  Found in app/Util/ActivityPub/Helpers.php and 1 other location - About 1 hr to fix
                                  app/Util/ActivityPub/Helpers.php on lines 130..142

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

                                  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