Showing 1,326 of 1,561 total issues
Function verifySignature
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
protected function verifySignature($headers, $payload)
{
$body = $this->payload;
$bodyDecoded = $payload;
$signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
- 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 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get(Status $status)
{
if($status->uri || $status->scope != 'public') {
return;
}
Method handle
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$res = $this->activity;
$status = $this->status;
Method formStore
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formStore(Request $request)
{
$this->validate($request, [
'report' => 'required|alpha_dash',
'type' => 'required|alpha_dash',
Method statusFavouritedBy
has 77 lines of code (exceeds 25 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);
Method apiActivityLog
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function apiActivityLog(Request $request, $id)
{
$record = CuratedRegister::findOrFail($id);
$res = collect([
Method redirect
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function redirect(Request $request)
{
abort_unless((
config_cache('pixelfed.open_registration') &&
config('remote-auth.mastodon.enabled')
AccountController
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class AccountController extends Controller
{
protected $filters = [
'user.mute',
'user.block',
Method statusReplies
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function statusReplies(Request $request, $id)
{
abort_if(! $request->user(), 403);
$this->validate($request, [
Method thread
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function thread(Request $request)
{
$this->validate($request, [
'pid' => 'required'
]);
Method settingsApiUpdateStorageType
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function settingsApiUpdateStorageType($request)
{
$this->validate($request, [
'primary_disk' => 'required|in:local,cloud',
'update_disk' => 'sometimes',
Method block
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function block(Request $request)
{
$this->validate($request, [
'type' => 'required|string|in:user',
'item' => 'required|integer|min:1',
Method statusRebloggedBy
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function statusRebloggedBy(Request $request, $id)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('read'), 403);
Method handle
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$this->info('Pixelfed Avatar Storage Manager');
$this->line(' ');
$segments = [
File AdminCuratedRegisterController.php
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers;
use App\Mail\CuratedRegisterAcceptUser;
Function storeStatus
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function storeStatus($url, $profile, $activity)
{
$originalUrl = $url;
$id = isset($activity['id']) ? self::pluckval($activity['id']) : self::pluckval($activity['url']);
$url = isset($activity['url']) && is_string($activity['url']) ? self::pluckval($activity['url']) : self::pluckval($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 warmCache
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function warmCache($id, $force = false, $limit = 100, $returnIds = false)
{
if(self::count($id) == 0 || $force == true) {
Redis::del(self::CACHE_KEY . $id);
$following = Cache::remember('profile:following:'.$id, 1209600, function() use($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 21 (exceeds 5 allowed). Consider refactoring. Open
public function store(Request $request)
{
abort_unless(config('import.instagram.enabled'), 404);
$this->checkPermissions($request);
- 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 accountBlockById
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function accountBlockById(Request $request, $id)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('write'), 403);
Method handle
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$totalUserCount = Profile::whereNotNull('user_id')->count();
$totalInstanceCount = Instance::count();
$this->info('Found ' . $totalUserCount . ' local accounts and ' . $totalInstanceCount . ' remote instances');