pixelfed/pixelfed

View on GitHub

Showing 1,326 of 1,561 total issues

Method importBackup has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function importBackup(Request $request)
    {
        $this->validate($request, [
            'banned' => 'sometimes|array',
            'auto_cw' => 'sometimes|array',
Severity: Minor
Found in app/Http/Controllers/Admin/AdminInstanceController.php - About 1 hr to fix

    Method apps has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function apps(Request $request)
        {
            abort_if(! (bool) config_cache('pixelfed.oauth_enabled'), 404);
    
            $this->validate($request, [
    Severity: Minor
    Found in app/Http/Controllers/Api/ApiV1Controller.php - About 1 hr to fix

      Method autospam has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function autospam(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 accountChangePassword has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method avatarUpdate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function avatarUpdate(Request $request)
              {
                  abort_if(!$request->user(), 403);
          
                  $this->validate($request, [
          Severity: Minor
          Found in app/Http/Controllers/Api/BaseApiController.php - About 1 hr to fix

            Method scopeCheck has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function scopeCheck(Profile $profile, Status $status)
                {
                    if($profile->is_private == true && Auth::check() == false) {
                        abort(404);
                    }
            Severity: Minor
            Found in app/Http/Controllers/PublicApiController.php - About 1 hr to fix

              Method unfollowHashtag has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function unfollowHashtag(Request $request, $id)
                  {
                      abort_if(!$request->user(), 403);
              
                      $pid = $request->user()->profile_id;
              Severity: Minor
              Found in app/Http/Controllers/Api/V1/TagsController.php - About 1 hr to fix

                Method viewed has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function viewed(Request $request)
                    {
                        abort_if(! (bool) config_cache('instance.stories.enabled') || ! $request->user(), 404);
                
                        $this->validate($request, [
                Severity: Minor
                Found in app/Http/Controllers/Stories/StoryApiV1Controller.php - About 1 hr to fix

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

                      public function store(Request $request)
                      {
                          $this->validate($request, [
                              'acct' => 'required',
                          ]);
                  Severity: Minor
                  Found in app/Http/Controllers/ProfileAliasController.php - About 1 hr to fix

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

                        public function handle()
                        {
                            $chunk = 100;
                            $limit = Like::select('status_id')->groupBy('status_id')->get()->count();
                            
                    Severity: Minor
                    Found in app/Console/Commands/FixLikes.php - About 1 hr to fix

                      Method checkPHPRequiredDependencies has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function checkPHPRequiredDependencies()
                          {
                              $this->line(' ');
                              $this->info('Checking for Required PHP Extensions...');
                      
                      
                      Severity: Minor
                      Found in app/Console/Commands/Installer.php - About 1 hr to fix

                        Function handleViewActivity has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function handleViewActivity()
                            {
                                if(!isset(
                                    $this->payload['actor'],
                                    $this->payload['object']
                        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 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function handle(): void
                            {
                                $hid = $this->hid;
                                $pid = $this->pid;
                                $slug = strtolower($this->slug);
                        Severity: Minor
                        Found in app/Jobs/HomeFeedPipeline/HashtagUnfollowPipeline.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 remoteToCloud has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function remoteToCloud($media)
                            {
                                $url = $media->remote_url;
                        
                                if (! Helpers::validateUrl($url)) {
                        Severity: Minor
                        Found in app/Services/MediaStorageService.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 getVerifyCredentials has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function getVerifyCredentials($key, $secret, $region, $bucket, $endpoint)
                            {
                                $client = new S3Client([
                                    'version' => 'latest',
                                    'region' => $region,
                        Severity: Minor
                        Found in app/Services/FilesystemService.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 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function handle()
                            {
                                $media = $this->media;
                                if(!$media) {
                                    return;
                        Severity: Minor
                        Found in app/Jobs/ImageOptimizePipeline/ImageUpdate.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 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function get($url, $validateUrl = true)
                            {
                                if($validateUrl === true) {
                                    if(!Helpers::validateUrl($url)) {
                                        return 0;
                        Severity: Minor
                        Found in app/Services/ActivityPubFetchService.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 reportsHandleSpamAction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function reportsHandleSpamAction($appeal, $action)
                            {
                                $meta = json_decode($appeal->meta);
                        
                                if ($action == 'mark-read') {
                        Severity: Minor
                        Found in app/Http/Controllers/Admin/AdminReportController.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 getJson has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function getJson($url, $verifyCheck = true, $ttl = 3600, $allowRedirects = true)
                            {
                                $vc = $verifyCheck ? 'vc1:' : 'vc0:';
                                $ar = $allowRedirects ? 'ar1:' : 'ar0';
                                $key = self::CACHE_KEY.sha1($url).':'.$vc.$ar.$ttl;
                        Severity: Minor
                        Found in app/Services/FetchCacheService.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 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function handle($request, Closure $next)
                            {
                                $ar = [
                                    'login', 
                                    'logout',
                        Severity: Minor
                        Found in app/Http/Middleware/AccountInterstitial.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