open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 318 of 14,363 total issues

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

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

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

Function activate has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    activate($element) {
        let tags = $element.data('tags');
        let prepopulatedTags = $element.val().split(' ');
        let context = this;
        $element.tokenInput(tags, {

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

    public function setUp()
    {
        $this->node = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');
        $this->area = Phake::mock('OpenOrchestra\ModelInterface\Model\AreaInterface');
        $this->block = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
Severity: Minor
Found in Backoffice/Tests/Manager/NodeManagerTest.php - About 2 hrs to fix

Function _drawGraphic has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _drawGraphic(transitions , selector) {
        var g = new dagreD3.graphlib.Graph().setGraph({});
        g.graph().rankdir = 'LR';

        for (let transition of transitions) {

Method addFormElements has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addFormElements(FormEvent $event)
    {
        $form = $event->getForm();
        $data = $event->getData();

Severity: Minor
Found in Backoffice/EventSubscriber/SiteSubscriber.php - About 2 hrs to fix

Method newAction has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function newAction(Request $request, $siteId, $language, $parentId, $order)
    {
        $order = (int) $order;
        $nodeManager = $this->get('open_orchestra_backoffice.manager.node');
        $nodeRepository = $this->get('open_orchestra_model.repository.node');
Severity: Minor
Found in BackofficeBundle/Controller/NodeController.php - About 1 hr to fix

Method testResolver has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testResolver()
    {
        $this->form->configureOptions($this->resolver);
        Phake::verify($this->resolver)->setDefaults(array(
            'data_class' => $this->class,
Severity: Minor
Found in UserAdminBundle/Tests/Form/Type/UserTypeTest.php - About 1 hr to fix

Method buildForm has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('siteId', 'oo_site_choice', array(
            'label'        => 'open_orchestra_backoffice.form.redirection.site_name',
            'group_id'     => 'redirection',
Severity: Minor
Found in Backoffice/Form/Type/RedirectionType.php - About 1 hr to fix

Method newAction has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function newAction(Request $request, $contentTypeId, $language)
    {
        $siteId = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getSiteId();
        $site = $this->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);

Severity: Minor
Found in BackofficeBundle/Controller/ContentController.php - About 1 hr to fix

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

    public function setUp()
    {
        $this->redirectionClass = 'OpenOrchestra\ModelBundle\Document\Redirection';

        $this->contextManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');
Severity: Minor
Found in Backoffice/Tests/Manager/RedirectionManagerTest.php - About 1 hr to fix

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

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

        $this->blockType->configureOptions($resolver);
Severity: Minor
Found in Backoffice/Tests/Form/Type/BlockTypeTest.php - About 1 hr to fix

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

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(
            array(
                'data_class' => null,
Severity: Minor
Found in Backoffice/Form/Type/BlockType.php - About 1 hr to fix

Method provideEntityAndNodes has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideEntityAndNodes()
    {
        $blockWithoutNodeId = 'blockWithoutNodeId';
        $blockWithoutNode = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
        Phake::when($blockWithoutNode)->getAttributes()->thenReturn(array());

Function validate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate($value, Constraint $constraint)
    {
        $parameters = array(
            'initial_state' => 0,
            'translation_state' => 0,
Severity: Minor
Found in Workflow/Validator/Constraints/WorkflowParameterValidator.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 preSubmit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function preSubmit(FormEvent $event)
    {
        $data = $event->getData();
        $user = $event->getForm()->getData();
        if ($user instanceof UserInterface) {
Severity: Minor
Found in UserAdminBundle/EventSubscriber/UserProfilSubscriber.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 testGetPerimeterConfiguration has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testGetPerimeterConfiguration()
    {
        $result = $this->strategy->getPerimeterConfiguration('siteId');

        $this->assertEquals(array(

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

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => $this->class,
            'edit_groups' => true,
Severity: Minor
Found in UserAdminBundle/Form/Type/UserType.php - About 1 hr to fix

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

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

        $this->form->configureOptions($resolverMock);
Severity: Minor
Found in Backoffice/Tests/Form/Type/ContentTypeTypeTest.php - About 1 hr to fix
Severity
Category
Status
Source
Language