open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 14,363 of 14,363 total issues

ContextBackOfficeManagerTest has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class ContextBackOfficeManagerTest extends AbstractBaseTestCase
{
    /**
     * @var ContextBackOfficeManager
     */
Severity: Minor
Found in Backoffice/Tests/Context/ContextBackOfficeManagerTest.php - About 2 hrs to fix

AbstractVoterTest has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractVoterTest extends AbstractBaseTestCase
{
    protected $voter;

    protected $perimeterManager;
Severity: Minor
Found in Backoffice/Tests/Security/Authorization/Voter/AbstractVoterTest.php - About 2 hrs to fix

File symlink.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module.exports = {
    //--[ FONT MONTSERRAT ]--//
    font_montserrat_700_eot: {
        src: 'web/bundles/openorchestrabackoffice/font/Montserrat/fonts/Montserrat-700/Montserrat-700.eot',
        dest: 'web/fonts/Montserrat-700/Montserrat-700.eot'
Severity: Minor
Found in GruntTasks/Targets/symlink.js - About 2 hrs to fix

Method testConfigureOptions has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testConfigureOptions()
    {
        $resolver = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

        $this->form->configureOptions($resolver);
Severity: Major
Found in Backoffice/Tests/Form/Type/SiteTypeTest.php - About 2 hrs to fix

Method configureOptions has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function configureOptions(OptionsResolver $resolver)
    {
        $subGroupRender = array(
            'properties' => array(
                'rank' => 0,
Severity: Major
Found in Backoffice/Form/Type/NodeType.php - About 2 hrs to fix

Method execute has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);
        $aliasId = $input->getArgument('aliasId');
        $limit = 20;
Severity: Major
Found in BackofficeBundle/Command/OrchestraDeleteAliasCommand.php - About 2 hrs to fix

Method configureOptions has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(
            array(
                'data_class' => $this->siteClass,
Severity: Major
Found in Backoffice/Form/Type/SiteType.php - About 2 hrs to fix

File RouteDocumentManagerTest.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\Backoffice\Tests\Manager;

use Doctrine\Common\Collections\ArrayCollection;
Severity: Minor
Found in Backoffice/Tests/Manager/RouteDocumentManagerTest.php - About 2 hrs to fix

File NodeType.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\Backoffice\Form\Type;

use OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface;
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php - About 2 hrs to fix

AbstractDataTableView has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class AbstractDataTableView extends OrchestraView
{
    /**
     * Constructor
     *

Method setUp has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setUp()
    {
        $this->fieldTypesConfiguration = array(
            'text' =>
                array(
Severity: Major
Found in Backoffice/Tests/EventSubscriber/ContentTypeSubscriberTest.php - About 2 hrs to fix

Method testConfigureOptions has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testConfigureOptions()
    {
        $resolverMock = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');

        $this->nodeType->configureOptions($resolverMock);
Severity: Major
Found in Backoffice/Tests/Form/Type/NodeTypeTest.php - About 2 hrs to fix

Method provideStatuses has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideStatuses()
    {
        $fullStatus = $this->generateStatus(array(
            'initialState'       => true,
            'translationState'   => true,

Method setUp has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setUp()
    {
        $context = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');

        $repository = Phake::mock('OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface');

Function buildView has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        if ($form->getParent() &&
            $form->getParent()->getConfig()->getType()->getName() == 'collection' &&
            $form->getConfig()->getOption('columns')
Severity: Minor
Found in Backoffice/Form/Type/Extension/AccordionExtension.php - About 2 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

Function validateCondition has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateCondition($condition)
    {
        $is_boolean = true;
        if (!empty($condition)) {
            $encapsuledElements = array();
Severity: Minor
Found in Backoffice/Validator/Constraints/BooleanConditionValidator.php - About 2 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 buildForm has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (array_key_exists('property_path', $options) && is_null($options['property_path'])){
            $builder->setData($options['prototype_data']());
        }
Severity: Major
Found in Backoffice/Form/Type/FieldTypeType.php - About 2 hrs to fix

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

        $configuration = array(
            'open_orchestra_backoffice.role.contribution' => array(
                'firstpackage' => array(
                    'page' => array(
                        'EDITORIAL_NODE_CONTRIBUTOR' => array(
GroupBundle/Tests/Form/Type/GroupRoleTypeTest.php on lines 26..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 122.

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

        $configuration = array(
            'open_orchestra_backoffice.role.contribution' => array(
                'firstpackage' => array(
                    'page' => array(
                        'EDITORIAL_NODE_CONTRIBUTOR' => array(
Severity: Major
Found in GroupBundle/Tests/Form/Type/GroupRoleTypeTest.php and 1 other location - About 2 hrs to fix
GroupBundle/Tests/Form/DataTransformer/GroupRoleTransformerTest.php on lines 20..49

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

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

Method setUp has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setUp()
    {
        $this->fieldOptionClass = 'OpenOrchestra\ModelBundle\Document\FieldOption';
        $this->fieldTypeClass = 'OpenOrchestra\ModelBundle\Document\FieldType';
        $this->form = Phake::mock('Symfony\Component\Form\Form');
Severity: Major
Found in Backoffice/Tests/EventSubscriber/FieldTypeTypeSubscriberTest.php - About 2 hrs to fix
Severity
Category
Status
Source
Language