Showing 740 of 740 total issues
Method getColumnDDL
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getColumnDDL(Column $col): string
{
$domain = $col->getDomain();
$ddl = [$this->quoteIdentifier($col->getName())];
Method queryMethods
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function queryMethods(AbstractOMBuilder $builder): string
{
$script = '';
if ($this->withUpdatedAt()) {
Consider simplifying this complex logical expression. Open
if ($this->tableAlteringWorkaround && !$changedNotEditableThroughDirectDDL && $tableDiff->hasAddedColumns()) {
$addedCols = $tableDiff->getAddedColumns();
foreach ($addedCols as $column) {
$sqlChangeNotSupported =
//The column may not have a PRIMARY KEY or UNIQUE constraint.
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function getModifyTableIndicesDDL(TableDiff $tableDiff): string
{
$ret = '';
foreach ($tableDiff->getRemovedIndices() as $index) {
- 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 114.
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 function getModifyTableForeignKeysDDL(TableDiff $tableDiff): string
{
$ret = '';
foreach ($tableDiff->getRemovedFks() as $fk) {
- 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 114.
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
protected function addAddSelectColumns(string &$script): void
{
$script .= "
/**
* Add all the columns needed to create a new object.
- 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 114.
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
protected function addRemoveSelectColumns(string &$script): void
{
$script .= "
/**
* Remove all the columns needed to create a new object.
- 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 114.
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 getColumnFromName
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getColumnFromName(string $columnName, bool $failSilently = true): array
{
if (strpos($columnName, '.') === false) {
$prefix = (string)$this->getModelAliasOrName();
} else {
Method executeRollbackForDatasource
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function executeRollbackForDatasource(string $datasource, string $sql): void
{
$connection = $this->migrationManager->getConnection($datasource);
if ($this->isVerbose()) {
Method build
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build(): void
{
foreach ($this->getDatabases() as $database) {
$dotSyntax = "digraph G {\n";
Method addFieldsAttributes
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addFieldsAttributes(): string
{
$tableColumns = $this->getTable()->getColumns();
$fieldNamesPhpName = '';
Method join
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function join(string $relation, string $joinType = Criteria::INNER_JOIN)
{
// relation looks like '$leftName.$relationName $relationAlias'
[$fullName, $relationAlias] = self::getClassAndAlias($relation);
if (strpos($fullName, '.') === false) {
Method fixNamespaceDeclarations
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fixNamespaceDeclarations(string $source): string
{
$cooperativeLexems = [T_WHITESPACE, T_NS_SEPARATOR, T_STRING];
if (PHP_VERSION_ID >= 80000) {
Method addShiftRLValues
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addShiftRLValues(string &$script): void
{
$objectClassName = $this->objectClassName;
$useScope = $this->behavior->useScope();
$tableMapClassName = $this->builder->getTableMapClass();
Function format
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function format(?DataFetcherInterface $dataFetcher = null)
{
$this->checkInit();
if ($dataFetcher) {
$this->setDataFetcher($dataFetcher);
- 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 buildFixtures
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function buildFixtures(string $fixturesDir, array $connections, InputInterface $input, OutputInterface $output): int
{
if (!file_exists($this->root . '/' . $fixturesDir)) {
$output->writeln(sprintf('<error>Directory "%s" not found.</error>', $fixturesDir));
- 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 declareClassNamespace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function declareClassNamespace(string $class, string $namespace = '', $alias = false): string
{
$namespace = trim($namespace, '\\');
// check if the class is already declared
- 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 addClassBody
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function addClassBody(string &$script): void
{
$table = $this->getTable();
// namespaces
- 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 compareIndices
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function compareIndices(bool $caseInsensitive = false): int
{
$indexDifferences = 0;
$fromTableIndices = array_merge($this->getFromTable()->getIndices(), $this->getFromTable()->getUnices());
$toTableIndices = array_merge($this->getToTable()->getIndices(), $this->getToTable()->getUnices());
- 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 mergeStatements
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function mergeStatements(string $sql): string
{
$sqlParser = new SqlParser();
$sqlParser->setSQL($sql);
$statements = $sqlParser->explodeIntoStatements();
- 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"