open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 318 of 14,363 total issues

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

    getColumnsDefinition() {
        let columnsDefinition = [];
        if (this._collection.length > 1) {
            columnsDefinition.push(this._getColumnsDefinitionDeleteCheckbox());
        }

Method addMainAttributes has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addMainAttributes(FacadeInterface $facade, NodeInterface $node)
    {
        if ($site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
            $facade->templateSet = $site->getTemplateSet();
        }
Severity: Minor
Found in ApiBundle/Transformer/NodeTransformer.php - About 1 hr to fix

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

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

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

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

Method __construct has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

        NodeRepositoryInterface $nodeRepository,
        SiteRepositoryInterface $siteRepository,
        StatusRepositoryInterface $statusRepository,
        BlockRepositoryInterface  $blockRepository,
        ContextBackOfficeInterface $contextManager,
Severity: Major
Found in Backoffice/Manager/NodeManager.php - About 1 hr to fix

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

    public function formAction(Request $request, $siteId, $nodeId, $language, $version)
    {
        $nodeRepository = $this->get('open_orchestra_model.repository.node');
        if (null === $version) {
            $node = $nodeRepository->findInLastVersion($nodeId, $language, $siteId);
Severity: Minor
Found in BackofficeBundle/Controller/NodeController.php - About 1 hr to fix

Method testTransform has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testTransform(
        $id,
        $contentId,
        $contentType,
        $name,
Severity: Minor
Found in ApiBundle/Tests/Transformer/ContentTransformerTest.php - About 1 hr to fix

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

    getColumnsDefinition() {
        return [
            {
                name: "label",
                title: Translator.trans('open_orchestra_backoffice.table.shared_block.label'),

Method provideEvent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideEvent()
    {
        $formData0 = new ArrayCollection(array(
            'order0' => true,
            'order1' => true,

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

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

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

    public function setUp()
    {
        $this->keywordToDocumentManager = Phake::mock('OpenOrchestra\Backoffice\Manager\KeywordToDocumentManager');
        $this->keywordRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\KeywordRepositoryInterface');

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

    public function setUp()
    {
        $siteAlias1 = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteAliasInterface');
        Phake::when($siteAlias1)->getDomain()->thenReturn($this->siteDomain1);
        $siteAlias2 = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteAliasInterface');
Severity: Minor
Found in Backoffice/Tests/EventSubscriber/SiteSubscriberTest.php - About 1 hr to fix

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

    public function setUp()
    {
        $this->keywordToDocumentManager = Phake::mock('OpenOrchestra\Backoffice\Manager\KeywordToDocumentManager');
        $this->keywordRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\KeywordRepositoryInterface');

Function _activateSortableBlocks has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _activateSortableBlocks($template) {
        $('.block-container > div', $template).sortable({
            items: '> .block-item',
            handle: '.move-block',
            connectWith: '.block-container > div',

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

    public function setUp()
    {
        $translator = Phake::mock('Symfony\Component\Translation\TranslatorInterface');
        Phake::when($translator)->trans(\Phake::anyParameters())->thenReturn('test');
        $configuration = array(
Severity: Minor
Found in GroupBundle/Tests/Form/Type/GroupRoleTypeTest.php - About 1 hr to fix

Function _renderNodeActionToolbar has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _renderNodeActionToolbar($selector, routeName) {
        this._displayLoader($selector);
        let statuses = new Statuses();
        let nodeVersions = new Nodes();
        $.when(

Method testPreSetData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testPreSetData($id, $edit, $new)
    {
        $choices = array(
            'default' => 'default',
            'full_page' => 'full_page',

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

    public function setUp()
    {
        $this->site = Phake::mock('OpenOrchestra\ModelInterface\Model\ReadSiteInterface');
        Phake::when($this->site)->getSiteId()->thenReturn($this->siteId);

Severity: Minor
Found in Backoffice/Tests/Manager/AutoPublishManagerTest.php - About 1 hr to fix

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

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

Function changeStatusAction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function changeStatusAction(Request $request, $saveOldPublishedVersion)
    {
        $facade = $this->get('jms_serializer')->deserialize(
            $request->getContent(),
            'OpenOrchestra\ApiBundle\Facade\NodeFacade',
Severity: Minor
Found in ApiBundle/Controller/NodeController.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

Severity
Category
Status
Source
Language