pixelfed/pixelfed

View on GitHub

Showing 1,326 of 1,561 total issues

Method conversations has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function conversations(Request $request)
    {
        abort_if(! $request->user() || ! $request->user()->token(), 403);
        abort_unless($request->user()->tokenCan('read'), 403);

Severity: Major
Found in app/Http/Controllers/Api/ApiV1Controller.php - About 2 hrs to fix

    Method outbox has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function outbox()
        {
            $res = json_encode([
                "@context" => [
                    "https://www.w3.org/ns/activitystreams",
    Severity: Major
    Found in app/Http/Controllers/InstanceActorController.php - About 2 hrs to fix

      Method stepTwo has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function stepTwo($request)
          {
              if($request->filled('reason')) {
                  $request->session()->put('cur-reg.form-reason', $request->input('reason'));
              }
      Severity: Major
      Found in app/Http/Controllers/CuratedRegisterController.php - About 2 hrs to fix

        ApiV1Dot1Controller has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class ApiV1Dot1Controller extends Controller
        {
            protected $fractal;
        
            public function __construct()
        Severity: Minor
        Found in app/Http/Controllers/Api/ApiV1Dot1Controller.php - About 2 hrs to fix

          Method profileUpdateOrCreate has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function profileUpdateOrCreate($url)
              {
                  $res = self::fetchProfileFromUrl($url);
                  if (! $res || isset($res['id']) == false) {
                      return;
          Severity: Major
          Found in app/Util/ActivityPub/Helpers.php - About 2 hrs to fix

            Method unlinkRemoveMedia has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function unlinkRemoveMedia($status)
                {
            
                    if($status->in_reply_to_id) {
                        $parent = Status::find($status->in_reply_to_id);
            Severity: Major
            Found in app/Jobs/StatusPipeline/RemoteStatusDelete.php - About 2 hrs to fix

              Method buildProfile has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function buildProfile(Request $request, $user)
                  {
                      $username = $user->username;
                      $loggedIn = Auth::check();
                      $isPrivate = false;
              Severity: Major
              Found in app/Http/Controllers/ProfileController.php - About 2 hrs to fix

                File CollectionController.php has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace App\Http\Controllers;
                
                use Illuminate\Http\Request;
                Severity: Minor
                Found in app/Http/Controllers/CollectionController.php - About 2 hrs to fix

                  Method accountEmailsFromPixelfed has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function accountEmailsFromPixelfed(Request $request)
                      {
                          abort_if(! $request->user() || ! $request->user()->token(), 403);
                          abort_unless($request->user()->tokenCan('read'), 403);
                  
                  
                  Severity: Major
                  Found in app/Http/Controllers/Api/ApiV1Dot1Controller.php - About 2 hrs to fix

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

                        public function handle()
                        {
                            $actor = $this->actor;
                            $target = $this->target;
                    
                    
                    Severity: Major
                    Found in app/Jobs/FollowPipeline/UnfollowPipeline.php - About 2 hrs to fix

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

                          public function handle(): void
                          {
                              if((bool) config_cache('pixelfed.cloud_storage') === false) {
                                  return;
                              }
                      Severity: Major
                      Found in app/Jobs/VideoPipeline/VideoThumbnailToCloudPipeline.php - About 2 hrs to fix

                        Method verifySignature has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function verifySignature($headers, $payload)
                            {
                                $body = $this->payload;
                                $bodyDecoded = $payload;
                                $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
                        Severity: Major
                        Found in app/Jobs/InboxPipeline/DeleteWorker.php - About 2 hrs to fix

                          Method getAutospamConfigApi has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getAutospamConfigApi(Request $request)
                              {
                                  $open = Cache::remember('admin-dash:reports:spam-count', 3600, function() {
                                      return AccountInterstitial::whereType('post.autospam')->whereNull('appeal_handled_at')->count();
                                  });
                          Severity: Major
                          Found in app/Http/Controllers/Admin/AdminAutospamController.php - About 2 hrs to fix

                            Method settingsApiUpdateUsersType has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function settingsApiUpdateUsersType($request)
                                {
                                    $this->validate($request, [
                                        'require_email_verification' => 'required',
                                        'enforce_account_limit' => 'required',
                            Severity: Major
                            Found in app/Http/Controllers/Admin/AdminSettingsController.php - About 2 hrs to fix

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

                                  public function store(Request $request)
                                  {
                                      if (Auth::check() === false) {
                                          abort(403);
                                      }
                              Severity: Major
                              Found in app/Http/Controllers/CommentController.php - About 2 hrs to fix

                                Method comment has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function comment(Request $request)
                                    {
                                        abort_if(! (bool) config_cache('instance.stories.enabled') || ! $request->user(), 404);
                                        $this->validate($request, [
                                            'sid' => 'required',
                                Severity: Major
                                Found in app/Http/Controllers/Stories/StoryApiV1Controller.php - About 2 hrs to fix

                                  Function getMaxMastodon has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public static function getMaxMastodon($id = false, $start = 0, $limit = 10)
                                      {
                                          $ids = self::getRankedMaxId($id, $start, $limit);
                                  
                                          if (empty($ids)) {
                                  Severity: Minor
                                  Found in app/Services/NotificationService.php - About 2 hrs 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 updateUrls has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      protected function updateUrls()
                                      {
                                          $this->info('Updating urls...');
                                          $oldDomain = trim($this->argument('oldDomain'));
                                          $newDomain = trim($this->argument('newDomain'));
                                  Severity: Minor
                                  Found in app/Console/Commands/MediaCloudUrlRewrite.php - About 2 hrs 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

                                  File AdminUserController.php has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  
                                  namespace App\Http\Controllers\Admin;
                                  
                                  use Cache, DB;
                                  Severity: Minor
                                  Found in app/Http/Controllers/Admin/AdminUserController.php - About 2 hrs to fix

                                    File ImportPostController.php has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    <?php
                                    
                                    namespace App\Http\Controllers;
                                    
                                    use Illuminate\Http\Request;
                                    Severity: Minor
                                    Found in app/Http/Controllers/ImportPostController.php - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language