Showing 1,326 of 1,561 total issues
Method validate
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function validate($payload)
{
$valid = Validator::make($payload, [
'@context' => 'required',
'id' => 'required|string|url',
Method inAppRegistration
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function inAppRegistration(Request $request)
{
abort_if($request->user(), 404);
abort_unless((bool) config_cache('pixelfed.open_registration'), 404);
abort_unless((bool) config_cache('pixelfed.allow_app_registration'), 404);
Method mediaUpload
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mediaUpload(Request $request)
{
$this->validate($request, [
'file' => function() {
return [
Method transform
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transform(Status $status)
{
$mentions = $status->mentions->map(function ($mention) {
$webfinger = $mention->emailUrl();
$name = Str::startsWith($webfinger, '@') ?
Function settingsApiUpdateUsersType
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function settingsApiUpdateUsersType($request)
{
$this->validate($request, [
'require_email_verification' => 'required',
'enforce_account_limit' => 'required',
- Read upRead up
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 accountFollowingById
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function accountFollowingById(Request $request, $id)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('read'), 403);
- Read upRead up
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 accountFollowersById
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function accountFollowersById(Request $request, $id)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('read'), 403);
- Read upRead up
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 regularMode
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
protected function regularMode($minId, $limit, $log)
{
$gc = Media::whereRemoteMedia(false)
->whereNotNull(['status_id', 'cdn_url', 'replicated_at'])
->whereNot('version', '4')
- Read upRead up
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
Method handleImageTransform
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleImageTransform(Media $media, $thumbnail = false)
{
$path = $media->media_path;
$file = storage_path('app/'.$path);
if (!in_array($media->mime, $this->acceptedMimes)) {
File home.blade.php
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
@extends('admin.partial.template-full')
@section('section')
<div class="title">
<h3 class="font-weight-bold d-inline-block">Profiles</h3>
File Profile.php
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App;
use Auth, Cache, DB, Storage;
File ProfileController.php
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers;
use App\AccountInterstitial;
Method create
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request)
{
$this->validate($request, [
'to_id' => 'required',
'message' => 'required|string|min:1|max:500',
Function handleUndoActivity
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function handleUndoActivity()
{
$actor = $this->payload['actor'];
$profile = self::actorFirstOrCreate($actor);
$obj = $this->payload['object'];
- Read upRead up
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
Method accountStatusesById
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function accountStatusesById(Request $request, $id)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('read'), 403);
Method handle
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
if(config('filesystems.default') !== 'local') {
$this->error('Invalid default filesystem, set FILESYSTEM_DRIVER=local to proceed');
return Command::SUCCESS;
Method storeStatus
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function storeStatus($url, $profile, $activity)
{
$originalUrl = $url;
$id = isset($activity['id']) ? self::pluckval($activity['id']) : self::pluckval($activity['url']);
$url = isset($activity['url']) && is_string($activity['url']) ? self::pluckval($activity['url']) : self::pluckval($id);
Method handle
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$user = $this->user;
$profile = $user->profile;
$id = $user->profile_id;
Method spam
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function spam(Request $request)
{
$this->validate($request, [
'tab' => 'sometimes|in:home,not-spam,spam,settings,custom,exemptions',
]);
Method handle
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
if(!$this->confirm('Are you sure you want to run the fix status command?')) {
return;
}