pixelfed/pixelfed

View on GitHub

Showing 1,330 of 1,563 total issues

Avoid too many return statements within this method.
Open

            return '<span class="border border-info px-3 py-1 rounded text-white font-weight-bold">Awaiting User Response</span>';
Severity: Major
Found in app/Models/CuratedRegister.php - About 30 mins to fix

    Function handlePollVote has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handlePollVote()
        {
            $activity = $this->payload['object'];
            $actor = $this->actorFirstOrCreate($this->payload['actor']);
    
    
    Severity: Minor
    Found in app/Util/ActivityPub/Inbox.php - About 25 mins 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 handleAcceptActivity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handleAcceptActivity()
        {
            $actor = $this->payload['object']['actor'];
            $obj = $this->payload['object']['object'];
            $type = $this->payload['object']['type'];
    Severity: Minor
    Found in app/Util/ActivityPub/Inbox.php - About 25 mins 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 handleAnnounceActivity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handleAnnounceActivity()
        {
            $actor = $this->actorFirstOrCreate($this->payload['actor']);
            $activity = $this->payload['object'];
    
    
    Severity: Minor
    Found in app/Util/ActivityPub/Inbox.php - About 25 mins 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 redirect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    window.App.redirect = function() {
        document.querySelectorAll('a').forEach(function(i,k) { 
            let a = i.getAttribute('href');
            if(a && a.length > 5 && a.startsWith('https://')) {
                let url = new URL(a);
    Severity: Minor
    Found in resources/assets/js/app.js - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handle(): void
        {
            $sid = $this->sid;
            $hid = $this->hid;
            $status = StatusService::get($sid, false);
    Severity: Minor
    Found in app/Jobs/HomeFeedPipeline/HashtagRemoveFanoutPipeline.php - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handle()
        {
            $profile = $this->profile;
    
            Cache::forget('avatar:'.$profile->id);
    Severity: Minor
    Found in app/Jobs/AvatarPipeline/RemoteAvatarFetchFromUrl.php - About 25 mins 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 profileFirstOrNew has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function profileFirstOrNew($url)
        {
            $url = self::validateUrl($url);
            if ($url == false) {
                return;
    Severity: Minor
    Found in app/Util/ActivityPub/Helpers.php - About 25 mins 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 deliver has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function deliver()
        {
            $status = $this->status;
            $types = [
                'photo',
    Severity: Minor
    Found in app/Jobs/StatusPipeline/StatusEntityLexer.php - About 25 mins 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 getDefaultRules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getDefaultRules()
        {
            return Cache::remember(self::DEFAULT_RULES_CACHE_KEY, now()->addDays(7), function() {
                try {
                    $res = Http::withOptions(['allow_redirects' => false])
    Severity: Minor
    Found in app/Services/Internal/BeagleService.php - About 25 mins 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 isDomainCompatible has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function isDomainCompatible($domain = false)
        {
            if(!$domain) {
                return false;
            }
    Severity: Minor
    Found in app/Services/Account/RemoteAuthService.php - About 25 mins 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 refetchAllPosts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function refetchAllPosts()
        {
            $profile = $this->profile;
            $res = ActivityPubFetchService::get($profile->remote_url, false);
            if(!$res) {
    Severity: Minor
    Found in app/Jobs/AdminPipeline/AdminProfileActionPipeline.php - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function get($account, $version = 1)
        {
            $mh = hash('sha256', date('Y').'-.-'.date('m'));
            
            if($account instanceOf User) {
    Severity: Minor
    Found in app/Services/MediaPathService.php - About 25 mins 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 lookupWebfingerUses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function lookupWebfingerUses($wf)
        {
            try {
                $res = Http::timeout(20)->retry(3, 750)->get('https://beagle.pixelfed.net/api/v1/raa/lookup?webfinger=' . $wf);
                if(!$res->ok()) {
    Severity: Minor
    Found in app/Services/Account/RemoteAuthService.php - About 25 mins 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 hasValidDns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function hasValidDns($domain)
        {
            if (! $domain || ! strlen($domain) || strpos($domain, '.') == -1) {
                return false;
            }
    Severity: Minor
    Found in app/Services/DomainService.php - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handle(): void
        {
            if ($this->batch()->cancelled()) {
                return;
            }
    Severity: Minor
    Found in app/Jobs/ProfilePipeline/ProfilePurgeNotificationsByDomain.php - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handle(): void
        {
            if ($this->batch()->cancelled()) {
                return;
            }
    Severity: Minor
    Found in app/Jobs/ProfilePipeline/ProfileMigrationMoveFollowersPipeline.php - About 25 mins 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 mutes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function mutes(int $profile_id)
        {
            $key = self::USER_MUTES_KEY . $profile_id;
            $warm = Cache::has($key . ':cached-v0');
            if($warm) {
    Severity: Minor
    Found in app/Services/UserFilterService.php - About 25 mins 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 blocks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function blocks(int $profile_id)
        {
            $key = self::USER_BLOCKS_KEY . $profile_id;
            $warm = Cache::has($key . ':cached-v0');
            if($warm) {
    Severity: Minor
    Found in app/Services/UserFilterService.php - About 25 mins 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 showAtomFeed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function showAtomFeed(Request $request, $user)
        {
            abort_if(! config('federation.atom.enabled'), 404);
    
            $pid = AccountService::usernameToId($user);
    Severity: Minor
    Found in app/Http/Controllers/ProfileController.php - About 25 mins 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