open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 318 of 14,363 total issues

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

    public function setUp()
    {
        $this->authorizationChecker = Phake::mock('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');
        $this->groupContext = Phake::mock('OpenOrchestra\BaseApi\Context\GroupContext');
        $multiLanguagesChoiceManager = Phake::mock('OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface');
Severity: Minor
Found in WorkflowAdminBundle/Tests/Tranformer/StatusTransformerTest.php - About 1 hr to fix

Function execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if ($siteId = $input->getOption('siteId')) {
            $site = $this->getContainer()->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
            if ($site) {
Severity: Minor
Found in BackofficeBundle/Command/OrchestraPublishElementCommand.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 activate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

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

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

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

    /**
     * Get url by method
     *

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

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if ($siteId = $input->getOption('siteId')) {
            $site = $this->getContainer()->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
            if ($site) {
Severity: Minor
Found in BackofficeBundle/Command/OrchestraUnpublishElementCommand.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 canChangeToPublishStatus has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function canChangeToPublishStatus(NodeInterface $node, array $parameters)
    {
        $areas = $node->getAreas();
        $routePattern = $node->getRoutePattern();
        foreach ($areas as $area) {
Severity: Minor
Found in Backoffice/BusinessRules/Strategies/NodeStrategy.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 transform has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function transform($value)
    {
        foreach ($this->groupRolesConfiguration as $tables) {
            foreach ($tables as $package => $rows) {
                foreach ($rows as $row => $roles) {
Severity: Minor
Found in GroupBundle/Form/DataTransformer/GroupRoleTransformer.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 partialReverseTransform has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function partialReverseTransform($keywords, $asString = true)
    {
        $keywordArray = $this->getKeywordAsArray($keywords);
        $referenceKeywords = new ArrayCollection();

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

    public function findUsageReferenceInOtherSite($siteId, $entities)
    {
        $usedOtherSite = array();
        $supportedEntities = array(BlockInterface::ENTITY_TYPE, ContentInterface::ENTITY_TYPE);
        /** @var UseTrackableInterface $entity */
Severity: Minor
Found in Backoffice/Command/OrchestraDeleteSiteTools.php - About 1 hr to fix

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

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

Function _submitPatch has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _submitPatch(event, context) {
        Backbone.Events.trigger('form:deactivate', this);

        let formView = this;
        let $form = $('form', this.$el);

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

    getColumnsDefinition() {
        return [
            {
                name: "date_time",
                title: Translator.trans('open_orchestra_log.table.date'),

Function manageVersionsContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    manageVersionsContent(contentTypeId, language, contentId, page) {
        this._displayLoader(Application.getRegion('content'));

        if (null === page) {
            page = 1

Method provideDeleteVersionContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideDeleteVersionContent()
    {
        $status0 = Phake::mock('OpenOrchestra\ModelInterface\Model\StatusInterface');
        Phake::when($status0)->isPublishedState()->thenReturn(false);
        $content0 = Phake::mock('OpenOrchestra\ModelInterface\Model\ContentInterface');
Severity: Minor
Found in Backoffice/Tests/BusinessRules/Strategies/ContentStrategyTest.php - About 1 hr to fix

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

    public function newAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, UserInterface::ENTITY_TYPE);

        $userClass = $this->container->getParameter('open_orchestra_user.document.user.class');
Severity: Minor
Found in UserAdminBundle/Controller/Admin/UserController.php - About 1 hr to fix

Method getOkVotes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getOkVotes()
    {
        $log = $this->createPhakeLog();
        $site = $this->createPhakeSite();
        $redirection = $this->createPhakeRedirection();

Method voteOnAttribute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        if ($this->isSuperAdmin($token)) {
            return true;
        }
Severity: Minor
Found in Backoffice/Security/Authorization/Voter/SiteAdministrationVoter.php - About 1 hr to fix

Function _submitPatch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _submitPatch(event, context) {
        Backbone.Events.trigger('form:deactivate', this);

        let formView = this;
        let $form = $('form', this.$el);

Function listUser has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Function editNode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    editNode(nodeId, language, version = null) {
        this._displayLoader(Application.getRegion('content'));
        let url = Routing.generate('open_orchestra_backoffice_node_form', {
            siteId : Application.getContext().get('siteId'),
            nodeId : nodeId,
Severity
Category
Status
Source
Language