pixelfed/pixelfed

View on GitHub

Showing 1,555 of 1,558 total issues

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

        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

        Function parseStreamUrl has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function parseStreamUrl($url)
            {
                $name = null;
                $key = null;
                $query = parse_url($url, PHP_URL_QUERY);
        Severity: Minor
        Found in app/Http/Controllers/LiveStreamController.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 mediaUpload has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function mediaUpload(Request $request)
            {
                $this->validate($request, [
                    'file'      => function() {
                        return [
        Severity: Minor
        Found in app/Http/Controllers/DirectMessageController.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 accountToId has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

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

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

        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()
            {
                $ids = AccountStatService::getAllPostCountIncr();
                if(!$ids || !count($ids)) {
                    return;
        Severity: Minor
        Found in app/Console/Commands/AccountPostCountStatUpdate.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