Showing 46 of 46 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function generateBase(Schema $schema)
{
$outputDirectory = $schema->absoluteDirectory . DIRECTORY_SEPARATOR . 'Base';
$this->createDirectory($outputDirectory);
- 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 146.
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 generateBase(Schema $schema)
{
$outputDirectory = $schema->absoluteDirectory . DIRECTORY_SEPARATOR . 'Base';
$this->createDirectory($outputDirectory);
- 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 146.
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
Query
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Query implements QueryInterface
{
const JOIN_TYPE_INNER = 'INNER';
const JOIN_TYPE_LEFT = 'LEFT';
Function transformColumns
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function transformColumns(array $columns)
{
foreach ($columns as $column) {
if (null == $column->phpName) {
$column->phpName = StringUtil::camelize($column->name, false);
- 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
TableMap
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class TableMap implements TableMapInterface
{
const COLUMN_TYPE_INTEGER = 1;
const COLUMN_TYPE_STRING = 2;
const COLUMN_TYPE_DOUBLE = 3;
Method getTableColumnConfigurationNode
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getTableColumnConfigurationNode()
{
$builder = new TreeBuilder();
$columnsNode = $builder->root('columns');
$columnsNode
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function generate(Schema $schema)
{
// First generate base
$this->generateBase($schema);
- 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 121.
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 generate(Schema $schema)
{
// First generate base
$this->generateBase($schema);
- 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 121.
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 pluralize
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function pluralize($word)
{
static $plurals = [
'/(quiz)$/i' => '\1zes',
'/^(ox)$/i' => '\1en',
Method execute
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$schemas = $this->getSchemas($this->getSchemaPath());
$connections = [];
$pendingDatabaseCount = 0;
Function execute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$schemas = $this->getSchemas($this->getSchemaPath());
$connections = [];
$pendingDatabaseCount = 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
Method getTableRelationConfigurationNode
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getTableRelationConfigurationNode()
{
$onActionBehaviors = ['CASCADE', 'NO ACTION', 'RESTRICT', 'SET NULL', 'SET DEFAULT'];
$builder = new TreeBuilder();
Method hydrateRelation
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function hydrateRelation(array $data, array $item, $alias)
{
$hash = Rocket::getTableMap($this->joins[$alias]['relation']['namespace'])->getPrimaryKeysHash($item);
$relationFrom = $this->joins[$alias]['from'];
$relationPhpName = $this->joins[$alias]['relation']['phpName'];
Function buildClauses
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function buildClauses()
{
$query = ' WHERE ';
// FIXME handle the case when a clause need to be encapsulated by parentheses
- 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 save
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function save(\PDO $con = null)
{
if ($this->_isDeleted) {
throw new \LogicException('Cannot save a deleted object');
}
- 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 load
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function load($path, array $options)
{
if (null != $path) {
if (!is_file($path)) {
throw new ConfigurationFileNotFoundException('The rocket configuration file is not found in the selected folder "' . $path . '"');
Function load
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function load($path, array $options)
{
if (null != $path) {
if (!is_file($path)) {
throw new ConfigurationFileNotFoundException('The rocket configuration file is not found in the selected folder "' . $path . '"');
- 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 transformColumns
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transformColumns(array $columns)
{
foreach ($columns as $column) {
if (null == $column->phpName) {
$column->phpName = StringUtil::camelize($column->name, false);
Method join
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function join($relation, $alias, $joinType = self::JOIN_TYPE_INNER, $with = false)
{
$relationTable = $relation;
$from = null;
Function validateRelations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function validateRelations(array $normalizedSchemas)
{
$transformerClass = $this->options['transformer']['relation']['class'];
if (is_object($transformerClass)) {
$schemaRelationTransformer = $transformerClass;
- 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"