Showing 1,327 of 1,562 total issues
Function statusRebloggedBy
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
Open
public function statusRebloggedBy(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
File web.php
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofactor', 'localization'])->group(function () {
Route::get('/', 'SiteController@home')->name('timeline.personal');
Route::redirect('/home', '/')->name('home');
Method carousel
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function carousel(Request $request)
{
abort_if(! (bool) config_cache('instance.stories.enabled') || ! $request->user(), 404);
$pid = $request->user()->profile_id;
Method selfCarousel
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function selfCarousel(Request $request)
{
abort_if(! (bool) config_cache('instance.stories.enabled') || ! $request->user(), 404);
$pid = $request->user()->profile_id;
Method handleStoryReactionActivity
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handleStoryReactionActivity()
{
if(!isset(
$this->payload['actor'],
$this->payload['id'],
Method handleStoryReplyActivity
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handleStoryReplyActivity()
{
if(!isset(
$this->payload['actor'],
$this->payload['id'],
Method checkPermissions
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function checkPermissions($request, $abortOnFail = true)
{
$user = $request->user();
if($abortOnFail) {
Method handle
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle()
{
if(!config('import.instagram.enabled')) {
return;
}
Method storeSettings
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function storeSettings(Request $request)
{
abort_if(!$request->user(), 403);
$this->validate($request, [
Method timelineHashtag
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function timelineHashtag(Request $request, $hashtag)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('read'), 403);
Status
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Status extends Model
{
use HasSnowflakePrimary, SoftDeletes;
/**
Method mediaUpload
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function mediaUpload(Request $request)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('write'), 403);
File SearchController.php
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace App\Http\Controllers;
use App\Hashtag;
Method moderatePost
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Function handleCreateActivity
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
public function handleCreateActivity()
{
$activity = $this->payload['object'];
if(config('autospam.live_filters.enabled')) {
$filters = config('autospam.live_filters.filters');
- 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 get
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function get()
{
return [
1 => [
"id" => 1,
Method handleUndoActivity
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handleUndoActivity()
{
$actor = $this->payload['actor'];
$profile = self::actorFirstOrCreate($actor);
$obj = $this->payload['object'];
Method reportsHandleSpamAction
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function reportsHandleSpamAction($appeal, $action)
{
$meta = json_decode($appeal->meta);
if ($action == 'mark-read') {
Method instance
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function instance(Request $request)
{
$contact = Cache::remember('api:v1:instance-data:contact', 604800, function () {
if(config_cache('instance.admin.pid')) {
return AccountService::getMastodon(config_cache('instance.admin.pid'), true);
Method accountNotifications
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function accountNotifications(Request $request)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('read'), 403);