open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 318 of 14,363 total issues

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

let RenderToolbarViewMixin = (superclass) => class extends superclass {

    /**
     * @param {Object} $selector
     * @param {string} routeName

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 userCanUpdateToStatus has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function userCanUpdateToStatus(UserInterface $user, StatusInterface $status, $subject)
    {
        /** @var GroupInterface $group */
        foreach ($user->getGroups() as $group) {
            $entityType = $this->getSubjectEntityType($subject);
Severity: Minor
Found in Workflow/Security/Authorization/Voter/AbstractWorkflowVoter.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 testTransform has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $id,
        $contentId,
        $contentType,
        $name,
        $version,
Severity: Major
Found in ApiBundle/Tests/Transformer/ContentTransformerTest.php - About 1 hr to fix

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

    protected function duplicateArea(NodeInterface $node, NodeInterface $newNode, $duplicateBlock = true)
    {
        foreach ($node->getAreas() as $areaId => $area) {
            $newArea = clone $area;
            $newNode->setArea($areaId, $newArea);
Severity: Minor
Found in Backoffice/Manager/NodeManager.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 generateRoutesForNode has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function generateRoutesForNode(NodeInterface $node, ReadSiteInterface $site, array $routePattern)
    {
        $routes = array();

        if (!$node instanceof NodeInterface) {
Severity: Minor
Found in Backoffice/Manager/RouteDocumentManager.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 updateStatus has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function updateStatus(EventStatusableInterface $event)
    {
        $statusableElement = $event->getStatusableElement();

        if (true === $statusableElement->getStatus()->isPublishedState() &&
Severity: Minor
Found in Backoffice/EventListener/UpdateStatusableElementPublished.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 addOptionsFormType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addOptionsFormType(FieldTypeInterface $data, $type, FormInterface $form)
    {
        if (is_null($type) || !array_key_exists($type, $this->fieldTypeParameters)) {
            return;
        }
Severity: Minor
Found in Backoffice/EventSubscriber/FieldTypeTypeSubscriber.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 refreshLanguagesByAliases has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function refreshLanguagesByAliases(UserInterface $user)
    {
        $sites = array();
        $siteIds = array();
        $allSite = $this->get('security.authorization_checker')->isGranted(ContributionRoleInterface::PLATFORM_ADMIN);
Severity: Minor
Found in UserAdminBundle/Controller/Admin/UserController.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 submit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function submit(FormEvent $event)
    {
        $block = $event->getForm()->getData();
        if (null !== $block) {
            $blockAttributes = array();
Severity: Minor
Found in Backoffice/EventSubscriber/BlockFormTypeSubscriber.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 generateStatusesPropertiesMap has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function generateStatusesPropertiesMap(array $statusCollection)
    {
        $statusMap = array();

        foreach ($statusCollection as $index => $status) {
Severity: Minor
Found in WorkflowAdminBundle/Controller/Admin/ParametersController.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 transform has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function transform($block, array $params = array())
    {
        if (!$block instanceof BlockInterface) {
            throw new TransformerParameterTypeException();
        }
Severity: Minor
Found in ApiBundle/Transformer/BlockTransformer.php - About 1 hr to fix

Method generateOptions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function generateOptions()
    {
        return array(
            array(null,
                array(
Severity: Minor
Found in Backoffice/Tests/EventSubscriber/ContentTypeTypeSubscriberTest.php - About 1 hr to fix

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

    public function setUp()
    {
        $configuration = array(
            'open_orchestra_backoffice.role.contribution' => array(
                'firstpackage' => array(
Severity: Minor
Found in GroupBundle/Tests/Form/DataTransformer/GroupRoleTransformerTest.php - About 1 hr to fix

Method provideEntityAndContents has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideEntityAndContents()
    {
        $contentId = 'contentId';
        $content = $this->createPhakeContent($contentId);
        $contentTypeId = 'contentTypeId';

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

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

        $this->nodeRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface');
Severity: Minor
Found in Backoffice/Tests/Manager/RouteDocumentManagerTest.php - About 1 hr to fix

Method getConfigTreeBuilder has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('open_orchestra_workflow_admin');

Severity: Minor
Found in WorkflowAdminBundle/DependencyInjection/Configuration.php - About 1 hr to fix

Function listGroup has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    listGroup(page) {
        if (null === page) {
            page = 1
        }
        this._displayLoader(Application.getRegion('content'));

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

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

Function exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {

    grunt.registerTask('babel:config', 'Open Orchestra task to find and compile es6 scripts', function () {
        var config = grunt.config('application.config');

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

Function getBreadcrumb has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getBreadcrumb() {
        return [
            {
                label:Translator.trans('open_orchestra_workflow_admin.menu.developer.title')
            },
Severity
Category
Status
Source
Language