pixelfed/pixelfed

View on GitHub

Showing 1,327 of 1,562 total issues

Method getMastodon has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getMastodon($id, $publicOnly = true)
    {
        $status = self::get($id, $publicOnly, true);
        if(!$status) {
            return null;
Severity: Minor
Found in app/Services/StatusService.php - About 1 hr to fix

    Method bookmarks has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function bookmarks(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 transform has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function transform(Status $status)
          {
              $taggedPeople = MediaTagService::get($status->id);
              $poll = $status->type === 'poll' ? PollService::get($status->id) : null;
              $rendered = config('exp.autolink') ?
      Severity: Minor
      Found in app/Transformer/Api/StatusStatelessTransformer.php - About 1 hr to fix

        Method sessionValidateUsername has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function sessionValidateUsername(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 create has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function create()
              {
                  $this->info('Create Invite');
                  $this->line('=============');
                  $this->info('Set an optional invite name (only visible to admins)');
          Severity: Minor
          Found in app/Console/Commands/AdminInviteCommand.php - About 1 hr to fix

            Method handleCreateActivity has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function handleCreateActivity()
                {
                    $activity = $this->payload['object'];
                    if(config('autospam.live_filters.enabled')) {
                        $filters = config('autospam.live_filters.filters');
            Severity: Minor
            Found in app/Util/ActivityPub/Inbox.php - About 1 hr to fix

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

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

                Function fixFileAndXHR has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function fixFileAndXHR () {
                    var isIE = !!global.ActiveXObject || (
                      '-ms-scroll-limit' in document.documentElement.style &&
                      '-ms-ime-align' in document.documentElement.style
                    )
                Severity: Minor
                Found in resources/assets/js/polyfill.js - About 1 hr to fix

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

                      public function handle()
                      {
                          $profile = $this->profile;
                          $pid = $profile->id;
                  
                  
                  Severity: Minor
                  Found in app/Jobs/DeletePipeline/DeleteRemoteProfilePipeline.php - About 1 hr to fix

                    Method userEditSubmit has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function userEditSubmit(Request $request, $id)
                        {
                            $user = User::findOrFail($id);
                            $profile = $user->profile;
                            $changed = false;
                    Severity: Minor
                    Found in app/Http/Controllers/Admin/AdminUserController.php - About 1 hr to fix

                      Method getAllStats has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getAllStats(Request $request)
                          {
                              abort_if(!$request->user() || !$request->user()->token(), 404);
                      
                              abort_unless($request->user()->is_admin === 1, 404);
                      Severity: Minor
                      Found in app/Http/Controllers/Api/AdminApiController.php - About 1 hr to fix

                        Method getPosts has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function getPosts()
                            {
                                $tag = $this->term;
                                $hash = hash('sha256', $tag);
                                if (Helpers::validateUrl($tag) != false &&
                        Severity: Minor
                        Found in app/Http/Controllers/SearchController.php - About 1 hr to fix

                          Method composeLookup has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function composeLookup(Request $request)
                              {
                                  $this->validate($request, [
                                      'q' => 'required|string|min:2|max:50',
                                      'remote' => 'nullable',
                          Severity: Minor
                          Found in app/Http/Controllers/DirectMessageController.php - About 1 hr to fix

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

                                public function handle()
                                {
                                    $path = $this->argument('path');
                            
                                    if (!file_exists($path) || !mime_content_type($path) == 'application/x-tar') {
                            Severity: Minor
                            Found in app/Console/Commands/ImportEmojis.php - About 1 hr to fix

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

                                  public function handle()
                                  {
                                      $actor = $this->actor;
                                      $target = $this->target;
                              
                              
                              Severity: Minor
                              Found in app/Jobs/FollowPipeline/UnfollowPipeline.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 get has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function get(Status $status)
                                  {
                                      if($status->uri || $status->scope != 'public') {
                                          return;
                                      }
                              Severity: Minor
                              Found in app/Util/Sentiment/Bouncer.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 toArray has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function toArray(Request $request): array
                                  {
                                      $instance = parse_url($this->uri, PHP_URL_HOST);
                                      $statuses = [];
                                      if($this->status_ids && count($this->status_ids)) {
                              Severity: Minor
                              Found in app/Http/Resources/AdminRemoteReport.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 labsStore has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function labsStore(Request $request)
                                  {
                                      $this->validate($request, [
                                          'profile_layout' => 'nullable',
                                          'dark_mode'    => 'nullable',
                              Severity: Minor
                              Found in app/Http/Controllers/Settings/LabsSettings.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 transform has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function transform(Notification $notification)
                                  {
                                      $res = [
                                          'id' => (string) $notification->id,
                                          'type' => $this->replaceTypeVerb($notification->action),
                              Severity: Minor
                              Found in app/Transformer/Api/NotificationTransformer.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 report has a Cognitive Complexity of 15 (exceeds 5 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: Minor
                              Found in app/Http/Controllers/Api/ApiV1Dot1Controller.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

                              Severity
                              Category
                              Status
                              Source
                              Language