pixelfed/pixelfed

View on GitHub

Showing 1,326 of 1,561 total issues

Method handleFlagActivity has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handleFlagActivity()
    {
        if(!isset(
            $this->payload['id'],
            $this->payload['type'],
Severity: Major
Found in app/Util/ActivityPub/Inbox.php - About 3 hrs to fix

    Method report has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method accountStatuses has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function accountStatuses(Request $request, $id)
          {
              $this->validate($request, [
                  'only_media' => 'nullable',
                  'pinned' => 'nullable',
      Severity: Major
      Found in app/Http/Controllers/PublicApiController.php - About 3 hrs to fix

        Function verifySignature has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function verifySignature($headers, $profile, $payload)
            {
                $body = $this->payload;
                $bodyDecoded = $payload;
                $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
        Severity: Minor
        Found in app/Jobs/InboxPipeline/InboxValidator.php - About 3 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 verifySignature has a Cognitive Complexity of 23 (exceeds 5 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: Minor
        Found in app/Jobs/InboxPipeline/InboxWorker.php - About 3 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 storeSettings has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function storeSettings(Request $request)
            {
                abort_if(!$request->user(), 403);
        
                $this->validate($request, [
        Severity: Minor
        Found in app/Http/Controllers/PortfolioController.php - About 3 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 settingsApiUpdateStorageType has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function settingsApiUpdateStorageType($request)
            {
                $this->validate($request, [
                    'primary_disk' => 'required|in:local,cloud',
                    'update_disk' => 'sometimes',
        Severity: Minor
        Found in app/Http/Controllers/Admin/AdminSettingsController.php - About 3 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 privacyStore has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function privacyStore(Request $request)
            {
                $settings = $request->user()->settings;
                $profile = $request->user()->profile;
                $fields = [
        Severity: Minor
        Found in app/Http/Controllers/Settings/PrivacySettings.php - About 3 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

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

            public function handle()
            {
                $activity = $this->activity;
                $activityId = $activity['id'];
                $activityActor = $activity['actor'];
        Severity: Major
        Found in app/Jobs/StoryPipeline/StoryFetch.php - About 3 hrs to fix

          File SettingsController.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace App\Http\Controllers;
          
          use App\AccountLog;
          Severity: Minor
          Found in app/Http/Controllers/SettingsController.php - About 3 hrs to fix

            Installer has 27 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Installer extends Command
            {
                /**
                 * The name and signature of the console command.
                 *
            Severity: Minor
            Found in app/Console/Commands/Installer.php - About 3 hrs to fix

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

                  public static function get()
                  {
                      return Cache::remember(self::CACHE_KEY, 900, function () {
                          $hls = [
                              'enabled' => config('media.hls.enabled'),
              Severity: Major
              Found in app/Util/Site/Config.php - About 3 hrs to fix

                Method handleDeleteActivity has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function handleDeleteActivity()
                    {
                        if(!isset(
                            $this->payload['actor'],
                            $this->payload['object']
                Severity: Major
                Found in app/Util/ActivityPub/Inbox.php - About 3 hrs to fix

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

                      public static function get($json = true)
                      {
                          $activeMonth = Nodeinfo::activeUsersMonthly();
                  
                          $totalUsers = Cache::remember('api:nodeinfo:users', 43200, function () {
                  Severity: Major
                  Found in app/Services/LandingService.php - About 3 hrs to fix

                    Method apiRegister has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function apiRegister(Request $request)
                        {
                            $this->validate($request, [
                                'token' => 'required',
                                'username' => [
                    Severity: Major
                    Found in app/Http/Controllers/AdminInviteController.php - About 3 hrs to fix

                      Method mediaUpload has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Method accountFollowersById has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function accountFollowersById(Request $request, $id)
                            {
                                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 3 hrs to fix

                          Method accountFollowingById has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function accountFollowingById(Request $request, $id)
                              {
                                  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 3 hrs to fix

                            Function encode has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function encode(array $image, int $components_x = 4, int $components_y = 4, bool $linear = false): string {
                                    if (($components_x < 1 || $components_x > 9) || ($components_y < 1 || $components_y > 9)) {
                                        throw new InvalidArgumentException("x and y component counts must be between 1 and 9 inclusive.");
                                    }
                                    $height = count($image);
                            Severity: Minor
                            Found in app/Util/Blurhash/Blurhash.php - About 3 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 normalizeAudience has a Cognitive Complexity of 22 (exceeds 5 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 3 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

                            Severity
                            Category
                            Status
                            Source
                            Language