pixelfed/pixelfed

View on GitHub

Showing 1,559 of 1,562 total issues

Method discoverAccountsPopular has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function discoverAccountsPopular(Request $request)
    {
        abort_if(! $request->user(), 403);

        $pid = $request->user()->profile_id;
Severity: Minor
Found in app/Http/Controllers/DiscoverController.php - About 1 hr to fix

    Method store has 33 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/BookmarkController.php - About 1 hr to fix

      Method conciergeStore has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function conciergeStore(Request $request)
          {
              abort_if($request->user(), 404);
              $rules = [
                  'sid' => 'required_if:action,email|integer|min:1|max:20000000',
      Severity: Minor
      Found in app/Http/Controllers/CuratedRegisterController.php - About 1 hr to fix

        Method mediaSettings has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function mediaSettings()
            {
                $this->line('');
                $this->info('Media Settings:');
                $optimize_media = $this->choice('Optimize media uploads? Requires jpegoptim and other dependencies!', ['false', 'true'], 1);
        Severity: Minor
        Found in app/Console/Commands/Installer.php - About 1 hr to fix

          Method installerSteps has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function installerSteps()
              {
                  $this->envCheck();
                  $this->envCreate();
                  $this->installType();
          Severity: Minor
          Found in app/Console/Commands/Installer.php - About 1 hr to fix

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

                public function handle(): void
                {
                    $sid = $this->sid;
                    $status = StatusService::get($sid, false);
            
            
            Severity: Minor
            Found in app/Jobs/HomeFeedPipeline/FeedInsertPipeline.php - About 1 hr to fix

              Method likedBy has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function likedBy($status)
                  {
                      $empty = [
                          'username' => null,
                          'others' => false
              Severity: Minor
              Found in app/Services/LikeService.php - About 1 hr to fix

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

                    public static function get($aid, $tid)
                    {
                        $actor = AccountService::get($aid, true);
                        $target = AccountService::get($tid, true);
                        if(!$actor || !$target) {
                Severity: Minor
                Found in app/Services/RelationshipService.php - About 1 hr to fix

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

                      public static function warmCache($force = false, $limit = 100)
                      {
                          if(self::count() == 0 || $force == true) {
                              $hideNsfw = config('instance.hide_nsfw_on_public_feeds');
                              Redis::del(self::CACHE_KEY);
                  Severity: Minor
                  Found in app/Services/NetworkTimelineService.php - About 1 hr to fix

                    Method getCollection has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function getCollection($id)
                        {
                            $collection = Cache::remember(self::CACHE_KEY . 'get:' . $id, 86400, function() use($id) {
                                $collection = Collection::find($id);
                                if(!$collection) {
                    Severity: Minor
                    Found in app/Services/CollectionService.php - About 1 hr to fix

                      Method privateAccountOptions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function privateAccountOptions(Request $request)
                          {
                              $this->validate($request, [
                                  'mode' => 'required|string|in:keep-all,mutual-only,only-followers,remove-all',
                                  'duration' => 'required|integer|min:60|max:525600',
                      Severity: Minor
                      Found in app/Http/Controllers/Settings/PrivacySettings.php - About 1 hr to fix

                        Method deleteId has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function deleteId(Request $request)
                            {
                                abort_if(!$request->user(), 403);
                                $this->validate($request, [
                                    'collection_id' => 'required|int|min:1|exists:collections,id',
                        Severity: Minor
                        Found in app/Http/Controllers/CollectionController.php - About 1 hr to fix

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

                              public function transform(Status $status)
                              {
                                  return [
                                      'id'                        => (string) $status->id,
                                      'created_at'                => $status->created_at->toJSON(),
                          Severity: Minor
                          Found in app/Transformer/Api/Mastodon/v1/StatusTransformer.php - About 1 hr to fix

                            Method sponsorStore has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function sponsorStore(Request $request)
                                {
                                    $this->validate($request, [
                                        'patreon' => 'nullable|string',
                                        'liberapay' => 'nullable|string',
                            Severity: Minor
                            Found in app/Http/Controllers/SettingsController.php - About 1 hr to fix

                              Method relistInstance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function relistInstance()
                                  {
                                      $id = search(
                                          'Search by domain',
                                          fn (string $value) => strlen($value) > 0
                              Severity: Minor
                              Found in app/Console/Commands/InstanceManager.php - About 1 hr to fix

                                Method unlistInstance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function unlistInstance()
                                    {
                                        $id = search(
                                            'Search by domain',
                                            fn (string $value) => strlen($value) > 0
                                Severity: Minor
                                Found in app/Console/Commands/InstanceManager.php - About 1 hr to fix

                                  Method unbanInstance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      protected function unbanInstance()
                                      {
                                          $id = search(
                                              'Search by domain',
                                              fn (string $value) => strlen($value) > 0
                                  Severity: Minor
                                  Found in app/Console/Commands/InstanceManager.php - About 1 hr to fix

                                    Method refetchRemoteAvatars has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected function refetchRemoteAvatars()
                                        {
                                            if(!$this->confirm('Are you sure you want to refetch all remote avatars? This could take a while.')) {
                                                return;
                                            }
                                    Severity: Minor
                                    Found in app/Console/Commands/AvatarStorage.php - About 1 hr to fix

                                      Method banInstance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          protected function banInstance()
                                          {
                                              $id = search(
                                                  'Search by domain',
                                                  fn (string $value) => strlen($value) > 0
                                      Severity: Minor
                                      Found in app/Console/Commands/InstanceManager.php - About 1 hr to fix

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

                                        <?php
                                        
                                        namespace App\Events\LiveStream;
                                        
                                        use Illuminate\Broadcasting\Channel;
                                        Severity: Major
                                        Found in app/Events/LiveStream/NewChatComment.php and 1 other location - About 1 hr to fix
                                        app/Events/LiveStream/BanUser.php on lines 1..51

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

                                        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