pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

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

    protected function validateNewAccount()
    {
        if (ProfileMigration::whereProfileId($this->user()->profile_id)->where('created_at', '>', now()->subDays(30))->exists()) {
            return 'Error - You have migrated your account in the past 30 days, you can only perform a migration once per 30 days.';
        }
Severity: Minor
Found in app/Http/Requests/ProfileMigrationStoreRequest.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 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 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

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

    public static function cacheSyncCheck($id, $scope = 'followers')
    {
        if($scope === 'followers') {
            if(Cache::get(self::FOLLOWERS_SYNC_KEY . $id) != null) {
                return;
Severity: Minor
Found in app/Services/FollowerService.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($request, Closure $next, $guard = null)
    {
        if(config('instance.restricted.enabled')) {
            if (!Auth::guard($guard)->check()) {
                $p = ['login', 'password*', 'loginAs*'];
Severity: Minor
Found in app/Http/Middleware/RestrictedAccess.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 getApFeed has a Cognitive Complexity of 6 (exceeds 5 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 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 privateAccountOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function privateAccountOptions(Request $request)
    {
        $this->validate($request, [
            'mode' => 'required|string|in:keep-all,mutual-only,only-followers,remove-all',
            'duration' => 'required|integer|min:60|max:525600',
Severity: Minor
Found in app/Http/Controllers/Settings/PrivacySettings.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 storeView has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

        $views = $request->input('_v');
Severity: Minor
Found in app/Http/Controllers/StatusController.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 storeShare has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function storeShare(Request $request)
    {
        $this->authCheck();

        $this->validate($request, [
Severity: Minor
Found in app/Http/Controllers/StatusController.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 bookmarks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function bookmarks(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 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 modReportHandle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function modReportHandle(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 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 autospamHandle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function autospamHandle(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 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 accountFollowRequestAccept has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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