open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 354 of 14,363 total issues

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 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 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 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());

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

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

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

    public function provideStatusAndUsage()
    {
        $status0 = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');
        Phake::when($status0)->isInitialState()->thenReturn(true);
        Phake::when($status0)->isPublishedState()->thenReturn(false);

Function addFormElements has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

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

Severity: Minor
Found in Backoffice/EventSubscriber/SiteSubscriber.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 process has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(ContainerBuilder $container)
    {
        $resourcePath = '.';

        foreach ($container->getResources() as $resource) {

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

module.exports = function(grunt) {

    grunt.registerTask('menu:compile', 'Open Orchestra task to find template underscore and compile it', function () {
        var config = grunt.config('application.config');

Severity: Minor
Found in GruntTasks/menu_task.js - About 1 hr to fix

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

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('label', 'text', array(
            'label' => 'open_orchestra_backoffice.form.block.label',
            'constraints' => new NotBlank(),
Severity: Minor
Found in Backoffice/Form/Type/BlockType.php - About 1 hr to fix

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

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

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

    public function formAction(Request $request, $contentId, $language, $version)
    {
        $content = $this->get('open_orchestra_model.repository.content')->findOneByLanguageAndVersion($contentId, $language, $version);
        if (!$content instanceof ContentInterface) {
            throw new \UnexpectedValueException();
Severity: Minor
Found in BackofficeBundle/Controller/ContentController.php - About 1 hr to fix

Function listContent has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    listContent(contentTypeId, language, page) {
        if (null === page) {
            page = 1
        }
        this._displayLoader(Application.getRegion('content'));

Method validate has 41 lines of code (exceeds 25 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

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

    public function setUp()
    {
        $this->eventDispatcher = Phake::mock('Symfony\Component\EventDispatcher\EventDispatcherInterface');

        $this->node = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');
Severity: Minor
Found in ApiBundle/Tests/Transformer/NodeTransformerTest.php - About 1 hr to fix
Severity
Category
Status
Source
Language