edde-framework/edde-framework

View on GitHub

Showing 143 of 143 total issues

Method getArgumentList has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        static public function getArgumentList(array $argv) {
            $argumentList = [];
            /** @noinspection ForeachInvariantsInspection */
            for ($i = 0, $j = count($argv); $i < $j; $i++) {
                $arg = $argv[$i];
Severity: Minor
Found in src/Edde/Common/Cli/CliUtils.php - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
    declare(strict_types=1);

    namespace Edde\Common\Schema;

Severity: Major
Found in src/Edde/Common/Schema/Link.php and 1 other location - About 1 hr to fix
src/Edde/Common/Schema/Collection.php on lines 1..55

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php
    declare(strict_types=1);

    namespace Edde\Common\Schema;

Severity: Major
Found in src/Edde/Common/Schema/Collection.php and 1 other location - About 1 hr to fix
src/Edde/Common/Schema/Link.php on lines 1..55

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        public function collection(string $name, IProperty $source, IProperty $target, bool $force = false): ISchema {
            if (isset($this->collectionList[$name]) && $force === false) {
                throw new SchemaException(sprintf('Schema [%s] already has collection named [%s].', $this->getSchemaName(), $name));
            }
            $this->collectionList[$name] = new Collection($name, $source, $target);
Severity: Major
Found in src/Edde/Common/Schema/Schema.php and 1 other location - About 1 hr to fix
src/Edde/Common/Schema/Schema.php on lines 158..164

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 113.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        public function link(string $name, IProperty $source, IProperty $target, bool $force = false): ISchema {
            if (isset($this->linkList[$name]) && $force === false) {
                throw new SchemaException(sprintf('Schema [%s] already contains link named [%s].', $this->getSchemaName(), $name));
            }
            $this->linkList[$name] = new Link($name, $source, $target);
Severity: Major
Found in src/Edde/Common/Schema/Schema.php and 1 other location - About 1 hr to fix
src/Edde/Common/Schema/Schema.php on lines 126..132

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 113.

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

Further Reading

Function createSchema has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        public function createSchema(INode $node): ISchema {
            $schema = new Schema($node->getName(), $node->getAttribute('namespace'));
            $schema->setMetaList($node->getMetaList()->array());
            $magic = $schema->getMeta('magic', true);
            foreach ($this->propertyListNodeQuery->filter($node) as $propertyNode) {
Severity: Minor
Found in src/Edde/Common/Schema/SchemaManager.php - About 1 hr to fix

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 match has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        protected function match(string $control, string $action) {
            $simpleRegexp = '[a-z0-9-]+';
            $parameterList = null;
            if (($match = StringUtils::match($action, '~^handle=(?<handleHandle>[a-z0-9-]+)$~')) !== null) {
                $parameterList['handle'] = $control . '.' . $match['handleHandle'];
Severity: Minor
Found in src/Edde/Common/Link/AbstractLinkGenerator.php - About 1 hr to fix

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 createFactoryList has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        static public function createFactoryList(array $factoryList): array {
            $factories = [];
            foreach ($factoryList as $name => $factory) {
                $current = null;
                if ($factory instanceof \stdClass) {
Severity: Minor
Found in src/Edde/Ext/Container/ContainerFactory.php - About 1 hr to fix

Method node has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function node(INode $node, \Iterator $iterator, ...$parameters) {
            $level = $node->getLevel();
            $stack = new \SplStack();
            /**
             * @var $levelTreeTraversal ITreeTraversal
Severity: Minor
Found in src/Edde/Common/Node/AbstractTreeTraversal.php - About 1 hr to fix

Method store has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function store(ICrate $crate): IStorage {
            $this->driver->setup();
            $schema = $crate->getSchema();
            if ($schema->getMeta('storable', false) === false) {
                throw new StorageException(sprintf('Crate [%s] is not marked as storable (in meta data).', $schema->getSchemaName()));
Severity: Minor
Found in src/Edde/Common/Database/DatabaseStorage.php - About 1 hr to fix

Method upgradeTo has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function upgradeTo(string $version = null): IUpgrade {
            if ($version === null) {
                end($this->upgradeList);
                $version = key($this->upgradeList);
            }
Severity: Minor
Found in src/Edde/Common/Upgrade/AbstractUpgradeManager.php - About 1 hr to fix

Method onEnter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        protected function onEnter(INode $node, \Iterator $iterator, ...$parameters) {
            switch ($node->getName()) {
                case 'minify-css':
                    if ($this->minify) {
                        throw new MacroException(sprintf('Css minify does not support recursion.'));
Severity: Minor
Found in src/Edde/Ext/Template/Macro/CssMacro.php - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        protected function formatFrom(INode $node) {
            $parameterList = [];
            $fromList = [];
            foreach ($this->fromNodeQuery->filter($node) as $fromNode) {
                $staticQuery = $this->fragment($fromNode);
Severity: Major
Found in src/Edde/Common/Query/AbstractStaticQueryFactory.php and 1 other location - About 1 hr to fix
src/Edde/Common/Query/AbstractStaticQueryFactory.php on lines 239..249

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 109.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        protected function formatSelect(INode $node) {
            $parameterList = [];
            $selectList = [];
            foreach ($this->selectNodeQuery->filter($node) as $selectNode) {
                $staticQuery = $this->fragment($selectNode);
Severity: Major
Found in src/Edde/Common/Query/AbstractStaticQueryFactory.php and 1 other location - About 1 hr to fix
src/Edde/Common/Query/AbstractStaticQueryFactory.php on lines 257..267

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 109.

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

Further Reading

Function dependency has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        public function dependency($instance, IDependency $dependency, bool $lazy = true) {
            if (is_object($instance) === false) {
                return $instance;
            }
            $class = get_class($instance);
Severity: Minor
Found in src/Edde/Common/Container/Container.php - About 1 hr to fix

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 upgradeTo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        public function upgradeTo(string $version = null): IUpgrade {
            if ($version === null) {
                end($this->upgradeList);
                $version = key($this->upgradeList);
            }
Severity: Minor
Found in src/Edde/Common/Upgrade/AbstractUpgradeManager.php - About 1 hr to fix

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 query has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        public function query(Iterator $iterator) {
            if ($this->filter === null) {
                $this->filter = $this->parse($this->query);
            }
            /** @var $node INode */
Severity: Minor
Found in src/Edde/Common/Node/NodeQuery.php - About 1 hr to fix

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 toNode has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        static public function toNode(\stdClass $stdClass, INode $node = null, string $class = null): INode {
            $createNode = function (string $class, string $name = null): INode {
                /** @var $node INode */
                if (($node = new $class()) instanceof INode === false) {
                    throw new ClassMismatchException(sprintf('Class specified [%s] is not instance of [%s].', $class, INode::class));
Severity: Minor
Found in src/Edde/Common/Node/NodeUtils.php - About 1 hr to fix

Method onEnter has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        protected function onEnter(INode $node, \Iterator $iterator, ...$parameters) {
            switch ($node->getName()) {
                case 'minify-js':
                    if ($this->minify) {
                        throw new MacroException(sprintf('Js minify does not support recursion.'));
Severity: Minor
Found in src/Edde/Ext/Template/Macro/JsMacro.php - About 1 hr to fix

Method node has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function node(\Iterator $iterator) {
            $stack = new \SplStack();
            $level = -1;
            /** @var $node INode */
            foreach ($iterator as $node) {
Severity: Minor
Found in src/Edde/Common/Xml/XmlExport.php - About 1 hr to fix
Severity
Category
Status
Source
Language