Showing 1,326 of 1,561 total issues
Method transform
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transform(Status $status)
{
return [
'@context' => [
'https://w3id.org/security/v1',
Method accountToId
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function accountToId(Request $request)
{
abort_unless((
config_cache('pixelfed.open_registration') &&
config('remote-auth.mastodon.enabled')
Method sessionCheck
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sessionCheck(Request $request)
{
abort_unless((
config_cache('pixelfed.open_registration') &&
config('remote-auth.mastodon.enabled')
Function handle
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
$status = $this->status;
$actor = $status->profile;
$reply = Status::find($status->in_reply_to_id);
- 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 handle
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function handle(): void
{
if ($this->batch()->cancelled()) {
return;
}
- 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 fetchAvatar
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function fetchAvatar($avatar, $local = false, $skipRecentCheck = false)
{
$queue = random_int(1, 15) > 5 ? 'mmo' : 'low';
$url = $avatar->remote_url;
$driver = $local ? 'local' : config('filesystems.cloud');
- 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 fixUncategorizedSpam
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function fixUncategorizedSpam(Request $request)
{
if (Cache::get('admin-dash:reports:spam-sync-active')) {
return redirect('/i/admin/reports/autospam');
}
- 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 create
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function create(Request $request)
{
$this->validate($request, [
'to_id' => 'required',
'message' => 'required|string|min:1|max:500',
- 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 handle
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function handle(): void
{
$this->info(' ____ _ ______ __ ');
$this->info(' / __ \(_) _____ / / __/__ ____/ / ');
$this->info(' / /_/ / / |/_/ _ \/ / /_/ _ \/ __ / ');
- 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 handle
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
if ((bool) config_cache('pixelfed.cloud_storage') == false) {
// Only run if cloud storage is enabled
return;
Method storePoll
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function storePoll($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id)
{
if (! isset($res['endTime']) || ! isset($res['oneOf']) || ! is_array($res['oneOf']) || count($res['oneOf']) > 4) {
return;
}
Method handle
has 39 lines of code (exceeds 25 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) {
Method handle
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$media = $this->media;
if($media->mime != 'video/mp4') {
return;
Method createPoll
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createPoll(Request $request)
{
$this->validate($request, [
'caption' => 'nullable|string|max:'.config_cache('pixelfed.max_caption_length', 500),
'cw' => 'nullable|boolean',
Method settingsApiUpdateType
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function settingsApiUpdateType(Request $request, $type)
{
abort_unless(in_array($type, [
'posts',
'platform',
Method getData
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getData()
{
$contact = Cache::remember('api:v1:instance:contact', now()->addMinutes(1440), function() {
$admin = User::whereIsAdmin(true)->first()->profile;
return [
Method index
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(Request $request)
{
$this->validate($request, [
'filter' => 'sometimes|in:open,all,awaiting,approved,rejected,responses',
'sort' => 'sometimes|in:asc,desc',
Method transform
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transform(Notification $notification)
{
$res = [
'id' => (string) $notification->id,
'type' => $this->replaceTypeVerb($notification->action),
Method scopeToAudience
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function scopeToAudience($audience)
{
if(!in_array($audience, ['to', 'cc']) || $this->local == false) {
return;
}
Method handlePollVote
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handlePollVote()
{
$activity = $this->payload['object'];
$actor = $this->actorFirstOrCreate($this->payload['actor']);