pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

Method exportStatuses has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function exportStatuses(Request $request)
    {
        $this->validate($request, [
            'type' => 'required|string|in:ap,api'
        ]);
Severity: Minor
Found in app/Http/Controllers/Settings/ExportSettings.php - About 1 hr to fix

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

        public function discoverAccountsPopular(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 mediaUpdate has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function mediaUpdate(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 inAppRegistrationConfirm has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function inAppRegistrationConfirm(Request $request)
            {
                abort_if($request->user(), 404);
                abort_unless((bool) config_cache('pixelfed.open_registration'), 404);
                abort_unless((bool) config_cache('pixelfed.allow_app_registration'), 404);
        Severity: Minor
        Found in app/Http/Controllers/Api/ApiV1Dot1Controller.php - About 1 hr to fix

          Method getUserCollections has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getUserCollections(Request $request, int $id)
              {
                  $user = $request->user();
                  $pid = $user ? $user->profile_id : null;
                  $follows = false;
          Severity: Minor
          Found in app/Http/Controllers/CollectionController.php - About 1 hr to fix

            Method content has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function content()
                {
                    $report = $this->report;
                    $object_type = last(explode("\\", $this->report->object_type));
                    $reporter = AccountService::get($report->profile_id, true);
            Severity: Minor
            Found in app/Mail/AdminNewReport.php - About 1 hr to fix

              Method searchAPI has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function searchAPI(Request $request)
                  {
                      $this->validate($request, [
                          'q' => 'required|string|min:3|max:120',
                          'src' => 'required|string|in:metro',
              Severity: Minor
              Found in app/Http/Controllers/SearchController.php - About 1 hr to fix

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

                    public function handle()
                    {
                        $id = $this->argument('id');
                        $force = $this->option('force');
                
                
                Severity: Minor
                Found in app/Console/Commands/UserDelete.php - About 1 hr to fix

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

                      public function handle()
                      {
                          $this->info('       ____  _           ______         __  ');
                          $this->info('      / __ \(_)  _____  / / __/__  ____/ /  ');
                          $this->info('     / /_/ / / |/_/ _ \/ / /_/ _ \/ __  /   ');
                  Severity: Minor
                  Found in app/Console/Commands/AdminInviteCommand.php - About 1 hr to fix

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

                            if ($status && isset($status['account'], $status['account']['acct']) && strpos($status['account']['acct'], '@') != -1) {
                                $domain = parse_url($status['account']['url'], PHP_URL_HOST);
                                abort_if(in_array($domain, InstanceService::getBannedDomains()), 404);
                            }
                    Severity: Major
                    Found in app/Http/Controllers/Api/ApiV1Controller.php and 1 other location - About 1 hr to fix
                    app/Http/Controllers/Api/ApiV1Controller.php on lines 1335..1338

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

                    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 && isset($status['account'], $status['account']['acct']) && strpos($status['account']['acct'], '@') != -1) {
                                $domain = parse_url($status['account']['url'], PHP_URL_HOST);
                                abort_if(in_array($domain, InstanceService::getBannedDomains()), 404);
                            }
                    Severity: Major
                    Found in app/Http/Controllers/Api/ApiV1Controller.php and 1 other location - About 1 hr to fix
                    app/Http/Controllers/Api/ApiV1Controller.php on lines 3031..3034

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

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

                        public function handleAcceptActivity()
                        {
                            $actor = $this->payload['object']['actor'];
                            $obj = $this->payload['object']['object'];
                            $type = $this->payload['object']['type'];
                    Severity: Minor
                    Found in app/Util/ActivityPub/Inbox.php - About 1 hr to fix

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

                          public function handle()
                          {
                              $follower = $this->follower;
                              $actor = $follower->actor;
                              $target = $follower->target;
                      Severity: Minor
                      Found in app/Jobs/FollowPipeline/FollowPipeline.php - About 1 hr to fix

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

                            public static function normalizeAudience($data, $localOnly = true)
                            {
                                if (! isset($data['to'])) {
                                    return;
                                }
                        Severity: Minor
                        Found in app/Util/ActivityPub/Helpers.php - About 1 hr to fix

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

                              public function handle()
                              {
                                  $like = $this->like;
                          
                                  $status = $this->like->status;
                          Severity: Minor
                          Found in app/Jobs/LikePipeline/LikePipeline.php - About 1 hr to fix

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

                                public static function getMastodonClient($domain)
                                {
                                    if(RemoteAuthInstance::whereDomain($domain)->exists()) {
                                        return RemoteAuthInstance::whereDomain($domain)->first();
                                    }
                            Severity: Minor
                            Found in app/Services/Account/RemoteAuthService.php - About 1 hr to fix

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

                                  public function searchTag(Request $request)
                                  {
                                      abort_if(! $request->user(), 403);
                              
                                      $this->validate($request, [
                              Severity: Minor
                              Found in app/Http/Controllers/ComposeController.php - About 1 hr to fix

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

                                    public function updateAppeal(Request $request, $id)
                                    {
                                        $this->validate($request, [
                                            'action' => 'required|in:dismiss,approve',
                                        ]);
                                Severity: Minor
                                Found in app/Http/Controllers/Admin/AdminReportController.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 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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language