open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 14,363 of 14,363 total issues

Function buildForm has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $configuration = array();
        $maxColumns = 0;

Severity: Minor
Found in GroupBundle/Form/Type/GroupRoleType.php - About 3 hrs 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

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

    public function testPublishNodes(array $fromStatus, $publishedStatus, $expectedReturn, $mustFlush)
    {
        Phake::when($this->statusRepository)->findByAutoPublishFrom()->thenReturn($fromStatus);
        Phake::when($this->statusRepository)->findOneByPublished()->thenReturn($publishedStatus);

Severity: Major
Found in Backoffice/Tests/Manager/AutoPublishManagerTest.php and 1 other location - About 3 hrs to fix
Backoffice/Tests/Manager/AutoPublishManagerTest.php on lines 165..176

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

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 testUnpublishNodes($publishedStatus, $unpublishedStatus, $expectedReturn, $mustFlush)
    {
        Phake::when($this->statusRepository)->findOneByPublished()->thenReturn($publishedStatus);
        Phake::when($this->statusRepository)->findOneByAutoUnpublishTo()->thenReturn($unpublishedStatus);

Severity: Major
Found in Backoffice/Tests/Manager/AutoPublishManagerTest.php and 1 other location - About 3 hrs to fix
Backoffice/Tests/Manager/AutoPublishManagerTest.php on lines 121..131

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

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

The class ContentController has 12 public methods. Consider refactoring ContentController to keep number of public methods under 10.
Open

class ContentController extends BaseController
{
    use ListStatus;

    /**

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class ContentController has an overall complexity of 50 which is very high. The configured complexity threshold is 50.
Open

class ContentController extends BaseController
{
    use ListStatus;

    /**

The class NodeController has an overall complexity of 53 which is very high. The configured complexity threshold is 50.
Open

class NodeController extends BaseController
{
    use ListStatus;

    /**

The class NodeController has 17 public methods. Consider refactoring NodeController to keep number of public methods under 10.
Open

class NodeController extends BaseController
{
    use ListStatus;

    /**

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class UpdateHistoryListSubscriber has 16 public methods. Consider refactoring UpdateHistoryListSubscriber to keep number of public methods under 10.
Open

class UpdateHistoryListSubscriber implements EventSubscriberInterface
{
    protected $tokenManager;
    protected $objectManager;
    protected $historyClass;

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class NodeStrategyTest has 11 public methods. Consider refactoring NodeStrategyTest to keep number of public methods under 10.
Open

class NodeStrategyTest extends AbstractBaseTestCase
{
    protected $nodeRepository;
    protected $strategy;
    protected $mainUrlArguments = array(

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class ContextManagerTest has 18 public methods. Consider refactoring ContextManagerTest to keep number of public methods under 10.
Open

class ContextManagerTest extends AbstractBaseTestCase
{
    /**
     * @var ContextManager
     */

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class ContextBackOfficeManagerTest has 17 public methods. Consider refactoring ContextBackOfficeManagerTest to keep number of public methods under 10.
Open

class ContextBackOfficeManagerTest extends AbstractBaseTestCase
{
    /**
     * @var ContextBackOfficeManager
     */

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class RouteDocumentManagerTest has 12 public methods. Consider refactoring RouteDocumentManagerTest to keep number of public methods under 10.
Open

class RouteDocumentManagerTest extends AbstractBaseTestCase
{
    /**
     * @var RouteDocumentManager
     */

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class NodeManagerTest has 13 public methods. Consider refactoring NodeManagerTest to keep number of public methods under 10.
Open

class NodeManagerTest extends AbstractBaseTestCase
{
    /**
     * @var NodeManager
     */

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

File ContentController.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\ApiBundle\Controller;

use OpenOrchestra\ApiBundle\Controller\ControllerTrait\ListStatus;
Severity: Minor
Found in ApiBundle/Controller/ContentController.php - About 3 hrs to fix

Function execute has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);
        $aliasId = $input->getArgument('aliasId');
        $limit = 20;
Severity: Minor
Found in BackofficeBundle/Command/OrchestraDeleteAliasCommand.php - About 3 hrs 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 addTemplateSetConfiguration has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addTemplateSetConfiguration()
    {
        $builder = new TreeBuilder();
        $templateSet = $builder->root('template_set');

Severity: Major
Found in BackofficeBundle/DependencyInjection/Configuration.php - About 3 hrs to fix

File Configuration.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\BackofficeBundle\DependencyInjection;

use OpenOrchestra\ModelInterface\Model\ContentInterface;
Severity: Minor
Found in BackofficeBundle/DependencyInjection/Configuration.php - About 3 hrs to fix

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

        $builder
            ->add('youtubeVideoId', 'oo_video', array(
                'label' => 'open_orchestra_backoffice.block.video.youtube.video_id',
                'group_id' => 'data',
                'sub_group_id' => 'content',
Severity: Major
Found in Backoffice/GenerateForm/Strategies/VideoStrategy.php and 2 other locations - About 3 hrs to fix
Backoffice/GenerateForm/Strategies/VideoStrategy.php on lines 177..215
Backoffice/GenerateForm/Strategies/VideoStrategy.php on lines 298..336

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

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 3 locations. Consider refactoring.
Open

        $builder
            ->add('dailymotionVideoId', 'oo_video', array(
                'label' => 'open_orchestra_backoffice.block.video.dailymotion.video_id',
                'group_id' => 'data',
                'sub_group_id' => 'content',
Severity: Major
Found in Backoffice/GenerateForm/Strategies/VideoStrategy.php and 2 other locations - About 3 hrs to fix
Backoffice/GenerateForm/Strategies/VideoStrategy.php on lines 53..90
Backoffice/GenerateForm/Strategies/VideoStrategy.php on lines 298..336

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

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 testBuilder()
    {
        $builder = Phake::mock('Symfony\Component\Form\FormBuilder');
        Phake::when($builder)->add(Phake::anyParameters())->thenReturn($builder);
        Phake::when($builder)->addEventSubscriber(Phake::anyParameters())->thenReturn($builder);
Severity: Major
Found in Backoffice/Tests/Form/Type/RedirectionTypeTest.php and 1 other location - About 3 hrs to fix
GroupBundle/Tests/Form/Type/GroupListTypeTest.php on lines 47..57

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

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

Severity
Category
Status
Source
Language