pixelfed/pixelfed

View on GitHub

Showing 1,299 of 1,530 total issues

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

    public function buildListing()
    {
        $res = config_cache('pixelfed.directory');
        if($res) {
            $res = is_string($res) ? json_decode($res, true) : $res;
Severity: Minor
Found in app/Http/Controllers/PixelfedDirectoryController.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 apiActivityLog has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function apiActivityLog(Request $request, $id)
    {
        $record = CuratedRegister::findOrFail($id);

        $res = collect([
Severity: Minor
Found in app/Http/Controllers/AdminCuratedRegisterController.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 getFollowedTags has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFollowedTags(Request $request)
    {
        abort_if(!$request->user(), 403);

        $account = AccountService::get($request->user()->profile_id);
Severity: Minor
Found in app/Http/Controllers/Api/V1/TagsController.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function transform(Profile $profile)
    {
        $res = [
            '@context' => [
                'https://w3id.org/security/v1',
Severity: Minor
Found in app/Transformer/ActivityPub/ProfileTransformer.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 accountFollowById has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function accountFollowById(Request $request, $id)
    {
        abort_if(! $request->user() || ! $request->user()->token(), 403);
        abort_unless($request->user()->tokenCan('follow'), 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

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

    public function avatarUrl()
    {
        $url = Cache::remember('avatar:'.$this->id, 1209600, function () {
            $avatar = $this->avatar;

Severity: Minor
Found in app/Profile.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()
    {
        $totalUserCount = Profile::whereNotNull('user_id')->count();
        $totalInstanceCount = Instance::count();
        $this->info('Found ' . $totalUserCount . ' local accounts and ' . $totalInstanceCount . ' remote instances');
Severity: Minor
Found in app/Console/Commands/SendUpdateActor.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 decode_base64 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    , decode_base64 = function(base64) {
        var
              len = base64.length
            , buffer = new Uint8Array(len / 4 * 3 | 0)
            , i = 0
Severity: Minor
Found in resources/assets/js/polyfill.js - About 1 hr to fix

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

        public function handle()
        {
            $username = $this->username;
            $headers = $this->headers;
    
    
    Severity: Minor
    Found in app/Jobs/InboxPipeline/InboxValidator.php - About 1 hr to fix

      Method handle has 31 lines of code (exceeds 25 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

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

            public function handle(): void
            {
                $depCheck = Cache::rememberForever('video-pipeline:hls:depcheck', function() {
                    $bin = config('laravel-ffmpeg.ffmpeg.binaries');
                    $output = shell_exec($bin . ' -version');
        Severity: Minor
        Found in app/Jobs/VideoPipeline/VideoHlsPipeline.php - About 1 hr to fix

          Method cropPhoto has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

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

                public function store(ProfileMigrationStoreRequest $request)
                {
                    abort_if((bool) config_cache('federation.activitypub.enabled') === false, 404);
                    $acct = WebfingerService::rawGet($request->safe()->acct);
                    if (! $acct) {
            Severity: Minor
            Found in app/Http/Controllers/ProfileMigrationController.php - About 1 hr to fix

              Method settings has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function settings(Request $request)
                  {
                      $cloud_storage = ConfigCacheService::get('pixelfed.cloud_storage');
                      $cloud_disk = config('filesystems.cloud');
                      $cloud_ready = ! empty(config('filesystems.disks.'.$cloud_disk.'.key')) && ! empty(config('filesystems.disks.'.$cloud_disk.'.secret'));
              Severity: Minor
              Found in app/Http/Controllers/Admin/AdminSettingsController.php - About 1 hr to fix

                Method instanceEdit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function instanceEdit(Request $request, $id)
                    {
                        $this->validate($request, [
                            'action' => [
                                'required',
                Severity: Minor
                Found in app/Http/Controllers/Admin/AdminInstanceController.php - About 1 hr to fix

                  Method mimeTypeCheck has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function mimeTypeCheck($mimes)
                      {
                          $allowed = explode(',', config_cache('pixelfed.media_types'));
                          $count = count($mimes);
                          $photos = 0;
                  Severity: Minor
                  Found in app/Http/Controllers/StatusController.php - About 1 hr to fix

                    Method statusById has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function statusById(Request $request, $id)
                        {
                            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 notifications has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Method updateFeatures has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function updateFeatures(Request $request)
                            {
                                abort_if(! $request->user(), 404);
                                abort_if(! $request->user()->is_admin, 404);
                                $pid = $request->user()->profile_id;
                        Severity: Minor
                        Found in app/Http/Controllers/DiscoverController.php - About 1 hr to fix

                          Method instances has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function instances(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
                            Severity
                            Category
                            Status
                            Source
                            Language