Showing 1,326 of 1,561 total issues
Function settingsHomeStore
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function settingsHomeStore(Request $request)
{
$this->validate($request, [
'name' => 'nullable|string',
'short_description' => 'nullable',
- 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 store
has 148 lines of code (exceeds 25 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',
Function handleDeleteActivity
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public function handleDeleteActivity()
{
if(!isset(
$this->payload['actor'],
$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
File StatusController.php
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers;
use App\AccountInterstitial;
File InternalApiController.php
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
Method resolveQuery
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function resolveQuery()
{
$default = [
'accounts' => [],
'hashtags' => [],
Method homeTimelineApi
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function homeTimelineApi(Request $request)
{
if(!$request->user()) {
return response('', 403);
}
Method publicTimelineApi
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function publicTimelineApi(Request $request)
{
$this->validate($request,[
'page' => 'nullable|integer|max:40',
'min_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
Function timelinePublic
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function timelinePublic(Request $request)
{
$this->validate($request, [
'min_id' => 'nullable|integer|min:0|max:'.PHP_INT_MAX,
'max_id' => 'nullable|integer|min:0|max:'.PHP_INT_MAX,
- 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 AdminDirectoryController.php
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\PixelfedDirectoryController;
Profile
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
class Profile extends Model
{
use HasSnowflakePrimary, SoftDeletes;
/**
Function handleFlagActivity
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function handleFlagActivity()
{
if(!isset(
$this->payload['id'],
$this->payload['type'],
- 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 timelineHome
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function timelineHome(Request $request)
{
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
Method get
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get($key)
{
$cacheKey = self::CACHE_KEY.$key;
$ttl = now()->addHours(12);
if (! config('instance.enable_cc')) {
Method autospamHandle
has 126 lines of code (exceeds 25 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);
Method updateSpam
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateSpam(Request $request, $id)
{
$this->validate($request, [
'action' => 'required|in:dismiss,approve,dismiss-all,approve-all,delete-account,mark-spammer',
]);
Method reportsHandleStatusAction
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function reportsHandleStatusAction($report, $action)
{
switch ($action) {
case 'ignore':
Report::whereObjectId($report->object_id)
Function reportsHandleProfileAction
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
protected function reportsHandleProfileAction($report, $action)
{
switch ($action) {
case 'ignore':
Report::whereObjectId($report->object_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
Method transform
has 122 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, '@') ?
File DiscoverController.php
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers;
use App\Hashtag;