Showing 1,326 of 1,561 total issues
Inbox
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Inbox
{
protected $headers;
protected $profile;
protected $payload;
FixDuplicateProfiles
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class FixDuplicateProfiles extends Command
{
/**
* The name and signature of the console command.
*
Method accountStatuses
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function accountStatuses(Request $request, $id)
{
$this->validate($request, [
'only_media' => 'nullable',
'pinned' => 'nullable',
Method accountFollowById
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function accountFollowById(Request $request, $id)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('follow'), 403);
Method getHashtags
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getHashtags(Request $request)
{
$user = $request->user();
abort_if(! config('instance.discover.tags.is_public') && ! $user, 403);
Method fetchAvatar
has 65 lines of code (exceeds 25 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');
Method transform
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transform(Profile $profile)
{
$res = [
'@context' => [
'https://w3id.org/security/v1',
Function mentionedUsernameExists
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function mentionedUsernameExists($username)
{
$key = 'pf:services:autolink:userexists:' . hash('sha256', $username);
return Cache::remember($key, 3600, function() use($username) {
- 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 19 (exceeds 5 allowed). Consider refactoring. Open
public function handle(): void
{
$payload = $this->payload;
if(empty($payload) || !isset($payload['actor'])) {
- 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 import
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function import($url, $id = false)
{
if((bool) config_cache('federation.custom_emoji.enabled') == false) {
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
File help.blade.php
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
@extends('site.partial.template')
@section('section')
<div class="title">
Method encode
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function encode(array $image, int $components_x = 4, int $components_y = 4, bool $linear = false): string {
if (($components_x < 1 || $components_x > 9) || ($components_y < 1 || $components_y > 9)) {
throw new InvalidArgumentException("x and y component counts must be between 1 and 9 inclusive.");
}
$height = count($image);
Method verifySignature
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function verifySignature($headers, $profile, $payload)
{
$body = $this->payload;
$bodyDecoded = $payload;
$signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
Method verifySignature
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function verifySignature($headers, $payload)
{
$body = $this->payload;
$bodyDecoded = $payload;
$signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
Method import
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function import($url, $id = false)
{
if((bool) config_cache('federation.custom_emoji.enabled') == false) {
return;
}
Method react
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function react(Request $request)
{
abort_if(! (bool) config_cache('instance.stories.enabled') || ! $request->user(), 404);
$this->validate($request, [
'sid' => 'required',
Method store
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function store(Request $request)
{
abort_unless(config('import.instagram.enabled'), 404);
$this->checkPermissions($request);
Method showAtomFeed
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showAtomFeed(Request $request, $user)
{
abort_if(! config('federation.atom.enabled'), 404);
$pid = AccountService::usernameToId($user);
Method reportsHandleStoryAction
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function reportsHandleStoryAction($report, $action)
{
switch ($action) {
case 'ignore':
Report::whereObjectId($report->object_id)
Method privacyStore
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function privacyStore(Request $request)
{
$settings = $request->user()->settings;
$profile = $request->user()->profile;
$fields = [