Showing 1,323 of 1,558 total issues
File ApiV2Controller.php
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Http\Controllers\Api;
use Illuminate\Http\Request;
Method handle
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$status = $this->status;
$profile = $status->profile;
Method handle
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(): void
{
$spamExists = Storage::exists(AutospamService::MODEL_SPAM_PATH);
if($spamExists) {
$spam = json_decode(Storage::get(AutospamService::MODEL_SPAM_PATH), true);
Method searchLocation
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function searchLocation(Request $request)
{
abort_if(! $request->user(), 403);
$this->validate($request, [
'q' => 'required|string|max:100',
Method storeText
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function storeText(Request $request)
{
abort_unless(config('exp.top'), 404);
$this->validate($request, [
'caption' => 'nullable|string|max:'.config_cache('pixelfed.max_caption_length', 500),
Method handle
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
if(config_cache('pixelfed.import.instagram.enabled') != true) {
return;
}
Method roleData
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function roleData()
{
return [
'account-force-private' => [
'title' => 'Force Private Account',
Method instance
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function instance(Request $request)
{
$res = Cache::remember('api:v1:instance-data-response-v1', 1800, function () {
$contact = Cache::remember('api:v1:instance-data:contact', 604800, function () {
if (config_cache('instance.admin.pid')) {
Method getProfiles
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getProfiles()
{
$tag = $this->term;
$remoteKey = $this->cacheKey.'profiles:remote:'.$this->hash;
$key = $this->cacheKey.'profiles:'.$this->hash;
Method handleSubmit
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleSubmit(Request $request)
{
abort_unless((
config_cache('pixelfed.open_registration') &&
config('remote-auth.mastodon.enabled')
Method getActor
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getActor()
{
return [
"@context" => [
"https://www.w3.org/ns/activitystreams",
Function handleVerb
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function handleVerb()
{
$verb = (string) $this->payload['type'];
switch ($verb) {
- 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 handleImageTransform
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function handleImageTransform(Media $media, $thumbnail = false)
{
$path = $media->media_path;
$file = storage_path('app/'.$path);
if (!in_array($media->mime, $this->acceptedMimes)) {
- 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 formStore
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function formStore(Request $request)
{
$this->validate($request, [
'report' => 'required|alpha_dash',
'type' => 'required|alpha_dash',
- 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 homeUpdate
has a Cognitive Complexity of 20 (exceeds 5 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'),
- 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 show
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function show(Request $request, $username, $id)
{
// redirect authed users to Metro 2.0
if ($request->user()) {
// unless they force static view
- 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 20 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
if(config('filesystems.default') !== 'local') {
$this->error('Invalid default filesystem, set FILESYSTEM_DRIVER=local to proceed');
return Command::SUCCESS;
- 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 validator
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validator(array $data)
{
if(config('database.default') == 'pgsql') {
$data['username'] = strtolower($data['username']);
$data['email'] = strtolower($data['email']);
Function stringDecode
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function stringDecode (buf) {
var end = buf.length
var res = []
var i = 0
Method handle
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$id = search(
label: 'Search for the account to delete by username',
placeholder: 'john.appleseed',