pixelfed/pixelfed

View on GitHub

Showing 1,326 of 1,561 total issues

Method getApFeed has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getApFeed(Request $request, $username)
    {
        $user = User::whereUsername($username)->first();

        if(!$user) {
Severity: Minor
Found in app/Http/Controllers/PortfolioController.php - About 1 hr to fix

    Method getSettings has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getSettings(Request $request)
        {
            abort_if(!$request->user(), 403);
    
            $res = Portfolio::whereUserId($request->user()->id)->get();
    Severity: Minor
    Found in app/Http/Controllers/PortfolioController.php - About 1 hr to fix

      Method inviteRegisterStore has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function inviteRegisterStore(Request $request, $id, $code)
          {
              if($request->user()) {
                  $title = 'You cannot complete this action on this device.';
                  $body = 'Please log out or use a different device or browser to complete the invitation registration.';
      Severity: Minor
      Found in app/Http/Controllers/ParentalControlsController.php - About 1 hr to fix

        Method statusShare has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function statusShare(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 createStream has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function createStream(Request $request)
              {
                  abort_if(!config('livestreaming.enabled'), 400);
                  abort_if(!$request->user(), 403);
          
          
          Severity: Minor
          Found in app/Http/Controllers/LiveStreamController.php - About 1 hr to fix

            Method modReports has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

                  public function transform(Media $media)
                  {
                      $res = [
                          'id'            => (string) $media->id,
                          'type'          => strtolower($media->activityVerb()),
              Severity: Minor
              Found in app/Transformer/Api/MediaTransformer.php - About 1 hr to fix

                Method toActivityPubObject has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function toActivityPubObject()
                    {
                        if($this->local == false) {
                            return;
                        }
                Severity: Minor
                Found in app/Status.php - About 1 hr to fix

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

                  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 12 (exceeds 5 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

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

                      public static function getId($userId, $year, $month, $day)
                      {
                          if($userId > 999999) {
                              return;
                          }
                  Severity: Minor
                  Found in app/Services/ImportService.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 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function get($key)
                      {
                          $cacheKey = self::CACHE_KEY.$key;
                          $ttl = now()->addHours(12);
                          if (! config('instance.enable_cc')) {
                  Severity: Minor
                  Found in app/Services/ConfigCacheService.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 12 (exceeds 5 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

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

                      public static function getScope($activity, $url)
                      {
                          $id = isset($activity['id']) ? self::pluckval($activity['id']) : self::pluckval($url);
                          $url = isset($activity['url']) ? self::pluckval($activity['url']) : self::pluckval($id);
                          $urlDomain = parse_url(self::pluckval($url), PHP_URL_HOST);
                  Severity: Minor
                  Found in app/Util/ActivityPub/Helpers.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 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle()
                      {
                          $status = $this->status;
                          $profile = $status->profile;
                  
                  
                  Severity: Minor
                  Found in app/Jobs/StatusPipeline/StatusActivityPubDeliver.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 handleStoryReactionActivity has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handleStoryReactionActivity()
                      {
                          if(!isset(
                              $this->payload['actor'],
                              $this->payload['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 handleStoryReplyActivity has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handleStoryReplyActivity()
                      {
                          if(!isset(
                              $this->payload['actor'],
                              $this->payload['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 handle has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle(): void
                      {
                          if((bool) config_cache('pixelfed.cloud_storage') === false) {
                              return;
                          }
                  Severity: Minor
                  Found in app/Jobs/VideoPipeline/VideoThumbnailToCloudPipeline.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 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle()
                      {
                          if(config_cache('pixelfed.import.instagram.enabled') != true) {
                              return;
                          }
                  Severity: Minor
                  Found in app/Jobs/ImportPipeline/ImportInstagram.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 accountNotifications has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function accountNotifications(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

                  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