open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 318 of 14,363 total issues

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

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

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

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

    public function getAvailableSites()
    {
        $sites = array();
        $token = $this->tokenStorage->getToken();
        if ($token instanceof TokenInterface) {
Severity: Minor
Found in Backoffice/Context/ContextBackOfficeManager.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 testSubmitWithExistingData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testSubmitWithExistingData()
    {
        $name = 'name';
        $status = 'status';
        $language = 'fr';
Severity: Minor
Found in Backoffice/Tests/EventSubscriber/ContentTypeSubscriberTest.php - About 1 hr to fix

Function getColumnsDefinition has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getColumnsDefinition() {
        return [
            this._getColumnsDefinitionDeleteCheckbox(),
            {
                name: "site_name",

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

    public function setUp()
    {
        $this->statusInitial = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');
        Phake::when($this->statusInitial)->getLabels()->thenReturn(array());
        Phake::when($this->statusInitial)->getName()->thenReturn($this->statusInitialLabel);
Severity: Minor
Found in Backoffice/Tests/Manager/ContentManagerTest.php - About 1 hr to fix

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

    public function setUp()
    {
        $contentType0 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');
        Phake::when($contentType0)->isDefiningVersionable()->thenReturn(true);
        $contentType1 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentTypeInterface');
Severity: Minor
Found in ApiBundle/Tests/Transformer/ContentTransformerTest.php - About 1 hr to fix

Function listSharedBlock has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    listSharedBlock(language, page) {
        if (null === language) {
            let user = Application.getContext().get('user');
            language = user.language.contribution;
        }

Method getBadRoles has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getBadRoles()
    {
        $actions = array(
            'Read'   => ContributionActionInterface::READ,
            'Edit'   => ContributionActionInterface::EDIT,

Method getNotSupportedSubjects has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getNotSupportedSubjects()
    {
        $content = $this->createPhakeContent();
        $trashItem = $this->createPhakeTrashItem();
        $site = $this->createPhakeSite();

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

    public function formAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, StatusInterface::ENTITY_TYPE);

        $statusCollection = $this->get('open_orchestra_model.repository.status')->findNotOutOfWorkflow();
Severity: Minor
Found in WorkflowAdminBundle/Controller/Admin/ParametersController.php - About 1 hr to fix
Severity
Category
Status
Source
Language