pixelfed/pixelfed

View on GitHub

Showing 1,326 of 1,561 total issues

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

    public static function get($aid, $tid)
    {
        $actor = AccountService::get($aid, true);
        $target = AccountService::get($tid, true);
        if(!$actor || !$target) {
Severity: Minor
Found in app/Services/RelationshipService.php - About 1 hr to fix

    Method getCollection has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getCollection($id)
        {
            $collection = Cache::remember(self::CACHE_KEY . 'get:' . $id, 86400, function() use($id) {
                $collection = Collection::find($id);
                if(!$collection) {
    Severity: Minor
    Found in app/Services/CollectionService.php - About 1 hr to fix

      Method likedBy has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function likedBy($status)
          {
              $empty = [
                  'username' => null,
                  'others' => false
      Severity: Minor
      Found in app/Services/LikeService.php - About 1 hr to fix

        Method warmCache has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function warmCache($force = false, $limit = 100)
            {
                if(self::count() == 0 || $force == true) {
                    $hideNsfw = config('instance.hide_nsfw_on_public_feeds');
                    Redis::del(self::CACHE_KEY);
        Severity: Minor
        Found in app/Services/NetworkTimelineService.php - About 1 hr to fix

          Method privateAccountOptions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function privateAccountOptions(Request $request)
              {
                  $this->validate($request, [
                      'mode' => 'required|string|in:keep-all,mutual-only,only-followers,remove-all',
                      'duration' => 'required|integer|min:60|max:525600',
          Severity: Minor
          Found in app/Http/Controllers/Settings/PrivacySettings.php - About 1 hr to fix

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

                public function transform(Status $status)
                {
                    return [
                        'id'                        => (string) $status->id,
                        'created_at'                => $status->created_at->toJSON(),
            Severity: Minor
            Found in app/Transformer/Api/Mastodon/v1/StatusTransformer.php - About 1 hr to fix

              Method sponsorStore has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function sponsorStore(Request $request)
                  {
                      $this->validate($request, [
                          'patreon' => 'nullable|string',
                          'liberapay' => 'nullable|string',
              Severity: Minor
              Found in app/Http/Controllers/SettingsController.php - About 1 hr to fix

                Method deleteId has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function deleteId(Request $request)
                    {
                        abort_if(!$request->user(), 403);
                        $this->validate($request, [
                            'collection_id' => 'required|int|min:1|exists:collections,id',
                Severity: Minor
                Found in app/Http/Controllers/CollectionController.php - About 1 hr to fix

                  Method relistInstance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function relistInstance()
                      {
                          $id = search(
                              'Search by domain',
                              fn (string $value) => strlen($value) > 0
                  Severity: Minor
                  Found in app/Console/Commands/InstanceManager.php - About 1 hr to fix

                    Method unbanInstance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function unbanInstance()
                        {
                            $id = search(
                                'Search by domain',
                                fn (string $value) => strlen($value) > 0
                    Severity: Minor
                    Found in app/Console/Commands/InstanceManager.php - About 1 hr to fix

                      Method refetchRemoteAvatars has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function refetchRemoteAvatars()
                          {
                              if(!$this->confirm('Are you sure you want to refetch all remote avatars? This could take a while.')) {
                                  return;
                              }
                      Severity: Minor
                      Found in app/Console/Commands/AvatarStorage.php - About 1 hr to fix

                        Method unlistInstance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function unlistInstance()
                            {
                                $id = search(
                                    'Search by domain',
                                    fn (string $value) => strlen($value) > 0
                        Severity: Minor
                        Found in app/Console/Commands/InstanceManager.php - About 1 hr to fix

                          Method banInstance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function banInstance()
                              {
                                  $id = search(
                                      'Search by domain',
                                      fn (string $value) => strlen($value) > 0
                          Severity: Minor
                          Found in app/Console/Commands/InstanceManager.php - About 1 hr to fix

                            Function handleUpdateActivity has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function handleUpdateActivity()
                                {
                                    $activity = $this->payload['object'];
                            
                                    if(!isset($activity['type'], $activity['id'])) {
                            Severity: Minor
                            Found in app/Util/ActivityPub/Inbox.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 run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            pixlfed.run = function() {
                                var lazyFrames = [].slice.call(document.querySelectorAll("div.pixelfed-embed"));
                            
                                if ("IntersectionObserver" in window) {
                                let lazyFrameObserver = new IntersectionObserver(function(entries, observer) {
                            Severity: Minor
                            Found in resources/assets/js/embed.js - 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 importActivity has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function importActivity($activity)
                                {
                                    $profile = $this->profile;
                                    $supported = $this->supported;
                                    $attachments = $activity['object']['attachment'];
                            Severity: Minor
                            Found in app/Jobs/RemoteFollowPipeline/RemoteFollowImportRecent.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 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function handle(): void
                                {
                                    $sid = $this->sid;
                                    $status = StatusService::get($sid, false);
                            
                            
                            Severity: Minor
                            Found in app/Jobs/HomeFeedPipeline/FeedInsertRemotePipeline.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 blindKeyRotation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function blindKeyRotation($headers, $profile, $payload)
                                {
                                    $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
                                    $date = is_array($headers['date']) ? $headers['date'][0] : $headers['date'];
                                    if(!$signature) {
                            Severity: Minor
                            Found in app/Jobs/InboxPipeline/InboxValidator.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 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function handle()
                                {
                                    $pid = $this->profileId;
                                    $type = $this->followType;
                            
                            

                            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 blindKeyRotation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function blindKeyRotation($headers, $payload)
                                {
                                    $signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
                                    $date = is_array($headers['date']) ? $headers['date'][0] : $headers['date'];
                                    if(!$signature) {
                            Severity: Minor
                            Found in app/Jobs/InboxPipeline/DeleteWorker.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