Showing 1,326 of 1,561 total issues
Method settingsApiUpdatePlatformType
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function settingsApiUpdatePlatformType($request)
{
$this->validate($request, [
'allow_app_registration' => 'required',
'app_registration_rate_limit_attempts' => 'required|integer|min:1',
Method comment
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function comment(Request $request)
{
abort_if(! (bool) config_cache('instance.stories.enabled') || ! $request->user(), 404);
$this->validate($request, [
'sid' => 'required',
File home.blade.php
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
@extends('admin.partial.template-full')
@section('section')
<div class="title d-flex justify-content-between align-items-center">
<h3 class="font-weight-bold">Users</h3>
Method handleFollowActivity
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleFollowActivity()
{
$actor = $this->actorFirstOrCreate($this->payload['actor']);
$target = $this->actorFirstOrCreate($this->payload['object']);
if(!$actor || !$target) {
Method getInstancesApi
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getInstancesApi(Request $request)
{
$this->validate($request, [
'filter' => [
'nullable',
Method transform
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transform(Profile $profile)
{
if (! $profile) {
return [];
}
Helpers
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Helpers
{
public static function validateObject($data)
{
$verbs = ['Create', 'Announce', 'Like', 'Follow', 'Delete', 'Accept', 'Reject', 'Undo', 'Tombstone'];
Method unlinkRemoveMedia
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function unlinkRemoveMedia($status)
{
Media::whereStatusId($status->id)
->get()
->each(function ($media) {
Method handle
has 58 lines of code (exceeds 25 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)) {
Method remoteToCloud
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function remoteToCloud($media)
{
$url = $media->remote_url;
if (! Helpers::validateUrl($url)) {
Method get
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get($domain)
{
$version = config('pixelfed.version');
$appUrl = config('app.url');
$headers = [
Method delete
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete(Request $request)
{
$this->authCheck();
$this->validate($request, [
Method homeUpdate
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function homeUpdate(Request $request)
{
$this->validate($request, [
'name' => 'nullable|string|max:'.config('pixelfed.max_name_length'),
'bio' => 'nullable|string|max:'.config('pixelfed.max_bio_length'),
Method handleUser
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleUser($user)
{
if(in_array($user->status, ['deleted', 'delete'])) {
return;
}
Method handle
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$this->info('Creating a new user...');
$o = $this->options();
Function handleNoteCreate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function handleNoteCreate()
{
$activity = $this->payload['object'];
$actor = $this->actorFirstOrCreate($this->payload['actor']);
if(!$actor || $actor->domain == null) {
- 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 getMinMastodon
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function getMinMastodon($id = false, $start = 0, $limit = 10)
{
$ids = self::getRankedMinId($id, $start, $limit);
if (empty($ids)) {
- 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 handleImmediateAttributes
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function handleImmediateAttributes(Status $status, $attributes)
{
if(isset($attributes['status'])) {
$cleaned = Purify::clean($attributes['status']);
$status->caption = $cleaned;
- 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 directoryInitialData
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function directoryInitialData(Request $request)
{
$res = [];
$res['countries'] = collect((new ISO3166)->all())->pluck('name');
- 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 mediaUploadV2
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function mediaUploadV2(Request $request)
{
abort_if(!$request->user() || !$request->user()->token(), 403);
abort_unless($request->user()->tokenCan('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"