Showing 1,326 of 1,561 total issues
Method handleDirectMessage
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleDirectMessage()
{
$activity = $this->payload['object'];
$actor = $this->actorFirstOrCreate($this->payload['actor']);
$profile = Profile::whereNull('domain')
Function userAdminAction
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
public function userAdminAction(Request $request)
{
abort_if(!$request->user() || !$request->user()->token(), 404);
abort_unless($request->user()->is_admin == 1, 404);
- 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 handleDirectMessage
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function handleDirectMessage()
{
$activity = $this->payload['object'];
$actor = $this->actorFirstOrCreate($this->payload['actor']);
$profile = Profile::whereNull('domain')
- 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 transform
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transform(Status $status)
{
$mentions = $status->mentions->map(function ($mention) {
$webfinger = $mention->emailUrl();
File SearchApiV2Service.php
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Services;
use App\Hashtag;
Method transform
has 113 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, '@') ?
Method directoryInitialData
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function directoryInitialData(Request $request)
{
$res = [];
$res['countries'] = collect((new ISO3166)->all())->pluck('name');
Method networkTimelineApi
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function networkTimelineApi(Request $request)
{
if(!$request->user()) {
return response('', 403);
}
Function handle
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
$id = $this->profileId;
if(Cache::has(FollowerService::FOLLOWERS_SYNC_KEY . $id) && Cache::has(FollowerService::FOLLOWING_SYNC_KEY . $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 store
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function store(Request $request)
{
$this->validate($request, [
'caption' => 'nullable|string|max:'.config_cache('pixelfed.max_caption_length', 500),
'media.*' => '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 moderatePost
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function moderatePost(Request $request, $id)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_if($request->user()->is_admin != true, 403);
abort_unless($request->user()->tokenCan('admin:write'), 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
Method mediaUploadV2
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mediaUploadV2(Request $request)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('write'), 403);
File CuratedRegisterController.php
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
File Status.php
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App;
use Auth, Cache, Hashids, Storage;
Method mediaUploadV2
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mediaUploadV2(Request $request)
{
abort_if(!$request->user() || !$request->user()->token(), 403);
abort_unless($request->user()->tokenCan('write'), 403);
File LiveStreamController.php
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
Function handle
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
$profile = null;
$headers = $this->headers;
$payload = json_decode($this->payload, true, 8);
- 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 statusFavouritedBy
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function statusFavouritedBy(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 handle
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
if(!config('import.instagram.enabled')) {
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
Method buildListing
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildListing()
{
$res = config_cache('pixelfed.directory');
if ($res) {
$res = is_string($res) ? json_decode($res, true) : $res;