Showing 464 of 573 total issues
Method getFunctions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFunctions(): array
{
return [
new TwigFunction('entry_url', [UrlExtensionRuntime::class, 'entryUrl']),
new TwigFunction('entry_edit_url', [UrlExtensionRuntime::class, 'entryEditUrl']),
Similar blocks of code found in 2 locations. Consider refactoring. Open
if(inputType === 'password'){
this.input.setAttribute('type', 'text');
this.previewIcon.classList.remove('fa-eye-slash');
this.previewIcon.classList.add('fa-eye');
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 57.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
}else{
this.input.setAttribute('type', 'password');
this.previewIcon.classList.remove('fa-eye');
this.previewIcon.classList.add('fa-eye-slash');
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 57.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function sendForm
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async sendForm(event) {
event.preventDefault();
const form = event.target.closest('form');
const url = form.action;
- 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 handleEntries
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async handleEntries(url) {
let response = await fetch(url, {method: 'GET'});
response = await ok(response);
- 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 buildResult
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildResult(array $result, $page, $countAll)
{
$entries = $this->entityManager->getRepository(Entry::class)->findBy(
['id' => $this->getOverviewIds((array) $result, 'entry')]
);
Method updateMagazine
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateMagazine(string $actorUrl): Magazine
{
$magazine = $this->magazineRepository->findOneBy(['apProfileId' => $actorUrl]);
$actor = $this->apHttpClient->getActorObject($actorUrl);
Method getStats
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStats(
?Magazine $magazine,
string $intervalStr,
?\DateTime $start,
?\DateTime $end,
Method create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create(
int $id = null,
MagazineSmallResponseDto $magazine = null,
UserSmallResponseDto $user = null,
DomainDto $domain = null,
Method getTests
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTests(): array
{
return [
new TwigTest(
'entry', function ($subject) {
Method byMagazine
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[OA\Response(
response: 200,
description: 'A paginated list of posts from the magazine',
content: new OA\JsonContent(
type: 'object',
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
// SPDX-FileCopyrightText: 2023 /kbin contributors <https://kbin.pub/>
//
// SPDX-License-Identifier: AGPL-3.0-only
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 102.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
// SPDX-FileCopyrightText: 2023 /kbin contributors <https://kbin.pub/>
//
// SPDX-License-Identifier: AGPL-3.0-only
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 102.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method __invoke
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[IsGranted('ROLE_USER')]
#[IsGranted('moderate', subject: 'comment')]
public function __invoke(
#[MapEntity(mapping: ['magazine_name' => 'name'])]
Magazine $magazine,
Method getDailyStats
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getDailyStats(): array
{
$conn = $this->getEntityManager()
->getConnection();
Method __invoke
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[IsGranted('moderate', subject: 'comment')]
public function __invoke(
#[MapEntity(mapping: ['magazine_name' => 'name'])]
Magazine $magazine,
#[MapEntity(id: 'entry_id')]
Method findOrCreateFromPath
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findOrCreateFromPath(string $source): ?Image
{
$fileName = $this->imageManager->getFileName($source);
$filePath = $this->imageManager->getFilePath($source);
$sha256 = hash_file('sha256', $source, true);
Method hydrate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function hydrate(PostComment ...$comment): void
{
$this->_em->createQueryBuilder()
->select('PARTIAL c.{id}')
->addSelect('u')
Method buildForm
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('query', TextType::class, [
'attr' => [
Method __invoke
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[OA\Response(
response: 200,
description: 'Returns a paginated list of entries from a specific user',
content: new OA\JsonContent(
type: 'object',