Showing 591 of 591 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function addNewRangedWeaponCode(
string $newRangedWeaponCodeValue,
WeaponCategoryCode $rangedWeaponCategoryCode,
array $translations
): bool
- 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 111.
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
public static function addNewMeleeWeaponCode(
string $newMeleeWeaponCodeValue,
WeaponCategoryCode $meleeWeaponCategoryCode,
array $translations
): bool
- 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 111.
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 fetchTranslations
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
return [
'en' => [
self::HORSE => [self::$ONE => 'horse', self::$FEW => 'horses', self::$MANY => 'horses'],
Method I_get_whispered_current_code_as_return_value_of_factory_method
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function I_get_whispered_current_code_as_return_value_of_factory_method()
{
foreach ($this->getCodeClasses() as $codeClass) {
$reflectionClass = new \ReflectionClass($codeClass);
$classBaseName = preg_replace('~^.*[\\\](\w+)$~', '$1', $codeClass);
Method getPossibleValues
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getPossibleValues(): array
{
return [
self::BARRIER_VENUS,
self::BARRIER_MARS,
Method All_public_constants_can_be_given_by_getter
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function All_public_constants_can_be_given_by_getter()
{
$constants = $this->sutReflection->getConstants();
self::assertEquals($constants, array_unique($constants));
asort($constants);
Function getTranslations
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function getTranslations(string $requiredLanguageCode): array
{
if ((self::$translations[static::class] ?? null) === null) {
$translations = self::$customCodeTranslations[static::class] ?? [];
if (count($translations) === 0) {
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
'cs' => [
self::STAB => [self::$ONE => 'bodné', self::$FEW => 'bodná', self::$MANY => 'bodných'],
self::CRUSH => [self::$ONE => 'drtivé', self::$FEW => 'drtivá', self::$MANY => 'drtivých'],
self::CUT => [self::$ONE => 'sečné', self::$FEW => 'sečná', self::$MANY => 'sečných'],
],
- 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 105.
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
'en' => [
self::STAB => [self::$ONE => 'stab', self::$FEW => 'stabs', self::$MANY => 'stabs'],
self::CRUSH => [self::$ONE => 'crush', self::$FEW => 'crushes', self::$MANY => 'crushes'],
self::CUT => [self::$ONE => 'cut', self::$FEW => 'cuts', self::$MANY => 'cuts'],
],
- 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 105.
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 I_can_get_all_codes_at_once_or_by_same_named_constant
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function I_can_get_all_codes_at_once_or_by_same_named_constant()
{
self::assertSame(
$expectedValues = [
// throwing weapons
Method getPossibleValues
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getPossibleValues(): array
{
return [
self::ARMOR_WEARING,
self::ATHLETICS,
Method getRaceToSubRaceValues
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getRaceToSubRaceValues(): array
{
return [
RaceCode::HUMAN => [
self::COMMON,
Method getExpectedRacesToSubRaces
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getExpectedRacesToSubRaces(): array
{
return [
'human' => [
'common',
Method I_can_extended_it_by_custom_translatable_code
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function I_can_extended_it_by_custom_translatable_code()
{
/** @var WeaponCode $sutClass */
$sutClass = self::getSutClass();
$reflectionClass = new \ReflectionClass($sutClass);
Function fetchTranslations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
$handle = \fopen($this->getTranslationsFileName(), 'rb');
$rows = [];
while (($row = \fgetcsv($handle)) !== false && $row !== null) {
- 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 checkTranslationsFormat
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function checkTranslationsFormat(array $translations)
{
/**
* @var string $languageCode
* @var array|string[] $languageTranslations
Method I_can_extended_it_by_custom_translatable_code
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function I_can_extended_it_by_custom_translatable_code()
{
/** @var TranslatableExtendableCode $sutClass */
$sutClass = self::getSutClass();
$translations = $this->sutReflection->getProperty('translations');
Method fetchTranslations
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fetchTranslations(): array
{
return [
'cs' => [
'one' => [
Similar blocks of code found in 3 locations. Consider refactoring. Open
public static function getMorningstarsAndMorgensternsValues(bool $withCustomValues = true): array
{
$defaultValues = [
self::LIGHT_MORGENSTERN,
self::MORGENSTERN,
- 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 101.
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 declare(strict_types=1);
namespace DrdPlus\Tests\Codes\Armaments;
use DrdPlus\Codes\Armaments\HelmCode;
- 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 101.
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