Showing 1,326 of 1,561 total issues
Function accountNotifications
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function accountNotifications(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
Function scopeCheck
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function scopeCheck(Profile $profile, Status $status)
{
if($profile->is_private == true && Auth::check() == false) {
abort(404);
}
- 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 accountToId
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function accountToId(Request $request)
{
abort_unless((
config_cache('pixelfed.open_registration') &&
config('remote-auth.mastodon.enabled')
- 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 mediaUpload
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function mediaUpload(Request $request)
{
$this->validate($request, [
'file' => function() {
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
Function parseStreamUrl
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function parseStreamUrl($url)
{
$name = null;
$key = null;
$query = parse_url($url, PHP_URL_QUERY);
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
$ids = AccountStatService::getAllPostCountIncr();
if(!$ids || !count($ids)) {
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
Method handle
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$pid = $this->profileId;
$type = $this->followType;
Method handle
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$media = $this->media;
$path = $media->media_path;
$thumb = $media->thumbnail_path;
Method headerBlurhash
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function headerBlurhash()
{
return Cache::rememberForever(self::CACHE_KEY_BANNER_BLURHASH, function() {
if(str_ends_with(config_cache('app.banner_image'), 'headers/default.jpg')) {
return 'UzJR]l{wHZRjM}R%XRkCH?X9xaWEjZj]kAjt';
Method reports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function reports(Request $request)
{
$filter = $request->input('filter') == 'closed' ? 'closed' : 'open';
$page = $request->input('page') ?? 1;
Method handleReportAction
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleReportAction(Report $report, $action)
{
$item = $report->reported();
$report->admin_seen = Carbon::now();
Method getConfiguration
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfiguration(Request $request)
{
abort_if(!$request->user() || !$request->user()->token(), 404);
abort_unless($request->user()->is_admin == 1, 404);
Method avatarUrl
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function avatarUrl()
{
$url = Cache::remember('avatar:'.$this->id, 1209600, function () {
$avatar = $this->avatar;
Method handle
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$action = select(
'What action do you want to perform?',
[
Function toBlob
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
canvas_proto.toBlob = function(callback, type /*, ...args*/) {
if (!type) {
type = "image/png";
} if (this.mozGetAsFile) {
callback(this.mozGetAsFile("canvas", type));
Method handleAnnounceActivity
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleAnnounceActivity()
{
$actor = $this->actorFirstOrCreate($this->payload['actor']);
$activity = $this->payload['object'];
Method generate
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function generate(Media $media)
{
if(!in_array($media->mime, ['image/png', 'image/jpeg', 'video/mp4'])) {
return self::DEFAULT_HASH;
}
Method mentionedUsernameExists
has 34 lines of code (exceeds 25 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) {
Method emailUpdate
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function emailUpdate(Request $request)
{
$this->validate($request, [
'email' => 'required|email|unique:users,email',
]);
Method exportStatuses
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exportStatuses(Request $request)
{
$this->validate($request, [
'type' => 'required|string|in:ap,api'
]);