pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

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

    protected function handle($status)
    {
        $media = $status->media;

        $ai = new AccountInterstitial;
Severity: Minor
Found in app/Util/Sentiment/Bouncer.php - About 1 hr to fix

    Method validateUrl has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function validateUrl($url)
        {
            if (is_array($url)) {
                $url = $url[0];
            }
    Severity: Minor
    Found in app/Util/ActivityPub/Helpers.php - About 1 hr to fix

      Method getAccountSettings has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method storeShare has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function storeShare(Request $request)
            {
                $this->authCheck();
        
                $this->validate($request, [
        Severity: Minor
        Found in app/Http/Controllers/StatusController.php - About 1 hr to fix

          Method userModerate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function userModerate(Request $request)
              {
                  $this->validate($request, [
                      'profile_id' => 'required|exists:profiles,id',
                      'action' => 'required|in:cw,no_autolink,unlisted'
          Severity: Minor
          Found in app/Http/Controllers/Admin/AdminUserController.php - About 1 hr to fix

            Method accountMuteById has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function accountMuteById(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 accountBlocks has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function accountBlocks(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 composeText has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function composeText(Request $request)
                    {
                        $this->validate($request, [
                            'type' => [
                                'required',
                Severity: Minor
                Found in app/Http/Controllers/MicroController.php - About 1 hr to fix

                  Method accountToId has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function accountToId(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 sessionCheck has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function sessionCheck(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 updateMediaSettings has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function updateMediaSettings(Request $request)
                          {
                              $this->validate($request, [
                                  'default' => 'required|int|min:1|max:16',
                                  'sync' => 'nullable',
                      Severity: Minor
                      Found in app/Http/Controllers/SettingsController.php - About 1 hr to fix

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

                            public function transform(Status $status)
                            {
                                return [
                                    '@context' => [
                                        'https://w3id.org/security/v1',
                        Severity: Minor
                        Found in app/Transformer/ActivityPub/Verb/CreateQuestion.php - About 1 hr to fix

                          Function handle has a Cognitive Complexity of 13 (exceeds 5 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

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function fixUncategorizedSpam has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function fixUncategorizedSpam(Request $request)
                              {
                                  if (Cache::get('admin-dash:reports:spam-sync-active')) {
                                      return redirect('/i/admin/reports/autospam');
                                  }
                          Severity: Minor
                          Found in app/Http/Controllers/Admin/AdminReportController.php - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function handle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function handle(): void
                              {
                                  if ($this->batch()->cancelled()) {
                                      return;
                                  }
                          Severity: Minor
                          Found in app/Jobs/ProfilePipeline/ProfilePurgeFollowersByDomain.php - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function fetchAvatar has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function fetchAvatar($avatar, $local = false, $skipRecentCheck = false)
                              {
                                  $queue = random_int(1, 15) > 5 ? 'mmo' : 'low';
                                  $url = $avatar->remote_url;
                                  $driver = $local ? 'local' : config('filesystems.cloud');
                          Severity: Minor
                          Found in app/Services/MediaStorageService.php - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function create(Request $request)
                              {
                                  $this->validate($request, [
                                      'to_id' => 'required',
                                      'message' => 'required|string|min:1|max:500',
                          Severity: Minor
                          Found in app/Http/Controllers/DirectMessageController.php - About 1 hr to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function handle has a Cognitive Complexity of 13 (exceeds 5 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

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

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

                              public function handle()
                              {
                                  $profile = $this->profile;
                          
                                  if ((bool) config_cache('pixelfed.cloud_storage') == false && (bool) config_cache('federation.avatars.store_local') == false) {
                          Severity: Minor
                          Found in app/Jobs/AvatarPipeline/RemoteAvatarFetch.php - About 1 hr to fix

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

                                public function handle()
                                {
                                    if ((bool) config_cache('pixelfed.cloud_storage') == false) {
                                        // Only run if cloud storage is enabled
                                        return;
                            Severity: Minor
                            Found in app/Jobs/MediaPipeline/MediaFixLocalFilesystemCleanupPipeline.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language