Showing 226 of 573 total issues
File subject_controller.js
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
// SPDX-FileCopyrightText: 2023 /kbin contributors <https://kbin.pub/>
//
// SPDX-License-Identifier: AGPL-3.0-only
import {Controller} from '@hotwired/stimulus';
Function findActorOrCreate
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function findActorOrCreate(string $actorUrlOrHandle): null|User|Magazine
{
if (str_contains($actorUrlOrHandle, $this->settingsManager->get('KBIN_DOMAIN').'/m/')) {
$magazine = str_replace('https://'.$this->settingsManager->get('KBIN_DOMAIN').'/m/', '', $actorUrlOrHandle);
- 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
UserRepository
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class UserRepository extends ServiceEntityRepository implements UserLoaderInterface, PasswordUpgraderInterface
{
public const PER_PAGE = 48;
public const USERS_ALL = 'all';
public const USERS_LOCAL = 'local';
File CreateClientApi.php
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
// SPDX-FileCopyrightText: 2023 /kbin contributors <https://kbin.pub/>
//
// SPDX-License-Identifier: AGPL-3.0-only
Function aggregateStats
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function aggregateStats(?Magazine $magazine, string $interval, ?\DateTime $end): array
{
if (null === $end) {
$end = new \DateTime();
}
- 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 create
has 25 arguments (exceeds 4 allowed). Consider refactoring. Open
int $id = null,
MagazineSmallResponseDto $magazine = null,
UserSmallResponseDto $user = null,
DomainDto $domain = null,
string $title = null,
Function addMainSubject
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
async addMainSubject(data) {
try {
const url = router().generate(`ajax_fetch_${getTypeFromNotification(data)}`, {id: data.detail.id});
let response = await fetch(url);
- 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
MagazineRepository
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class MagazineRepository extends ServiceEntityRepository
{
public const PER_PAGE = 48;
public const SORT_HOT = 'hot';
Method aggregateStats
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function aggregateStats(?Magazine $magazine, string $interval, ?\DateTime $end): array
{
if (null === $end) {
$end = new \DateTime();
}
Method create
has 21 arguments (exceeds 4 allowed). Consider refactoring. Open
int $id = null,
UserSmallResponseDto $user = null,
MagazineSmallResponseDto $magazine = null,
int $entryId = null,
int $parentId = null,
File EntryCommentsCreateApi.php
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
// SPDX-FileCopyrightText: 2023 /kbin contributors <https://kbin.pub/>
//
// SPDX-License-Identifier: AGPL-3.0-only
Method __construct
has 20 arguments (exceeds 4 allowed). Consider refactoring. Open
public string $KBIN_DOMAIN,
public string $KBIN_TITLE,
public string $KBIN_META_TITLE,
public string $KBIN_META_KEYWORDS,
public string $KBIN_META_DESCRIPTION,
Method create
has 20 arguments (exceeds 4 allowed). Consider refactoring. Open
MagazineModeratorResponseDto $owner = null,
ImageDto $icon = null,
string $name = null,
string $title = null,
string $description = null,
Method __construct
has 20 arguments (exceeds 4 allowed). Consider refactoring. Open
public ?bool $notifyOnNewEntry = null,
public ?bool $notifyOnNewEntryReply = null,
public ?bool $notifyOnNewEntryCommentReply = null,
public ?bool $notifyOnNewPost = null,
public ?bool $notifyOnNewPostReply = null,
Method create
has 20 arguments (exceeds 4 allowed). Consider refactoring. Open
int $id,
UserSmallResponseDto $user = null,
MagazineSmallResponseDto $magazine = null,
Post $post = null,
PostComment $parent = null,
Method create
has 20 arguments (exceeds 4 allowed). Consider refactoring. Open
int $id,
UserSmallResponseDto $user,
MagazineSmallResponseDto $magazine,
ImageDto $image = null,
string $body = null,
Function aggregateTotalStats
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function aggregateTotalStats(?Magazine $magazine): array
{
$conn = $this->getEntityManager()->getConnection();
$results = [];
- 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 __invoke
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function __invoke(PagerfantaInterface $activity, $sortBy = 'hot'): array
{
$postsAndEntries = array_filter(
$activity->getCurrentPageResults(),
fn ($val) => $val instanceof Entry || $val instanceof Post
- 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 PostCommentsCreateApi.php
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
// SPDX-FileCopyrightText: 2023 /kbin contributors <https://kbin.pub/>
//
// SPDX-License-Identifier: AGPL-3.0-only
Method __invoke
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __invoke(PagerfantaInterface $activity, $sortBy = 'hot'): array
{
$postsAndEntries = array_filter(
$activity->getCurrentPageResults(),
fn ($val) => $val instanceof Entry || $val instanceof Post