open-orchestra/open-orchestra-cms-bundle

View on GitHub

Showing 318 of 14,363 total issues

Function validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate($value, Constraint $constraint)
    {
        if($value instanceof ContentTypeInterface) {
            $fields = $value->getFields();
            foreach ($fields as $key => $field) {
Severity: Minor
Found in Backoffice/Validator/Constraints/ContentTypeFieldValidator.php - About 35 mins 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 getBackOfficeLanguage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getBackOfficeLanguage()
    {
        $currentLanguage = $this->session->get(self::KEY_LOCALE);

        if (!$currentLanguage) {
Severity: Minor
Found in Backoffice/Context/ContextBackOfficeManager.php - About 35 mins 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 addWorkflowProfile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function addWorkflowProfile(GroupFormEvent $event)
    {
        $builder = $event->getBuilder();
        $group = $builder->getData();
        $configuration = array();

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

    protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa)
    {
        $qa->match(array('extra.site_id' => $configuration->getSearchIndex('site_id')));

        $userName = $configuration->getSearchIndex('user_name');
Severity: Minor
Found in ModelLogBundle/Repository/LogRepository.php - About 35 mins 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

Avoid too many return statements within this method.
Open

        return false;
Severity: Major
Found in Backoffice/Security/Authorization/Voter/SiteAdministrationVoter.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return $this->voteForUser($subject, $user);
Severity: Major
Found in Backoffice/Security/Authorization/Voter/SiteAdministrationVoter.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return true;
Severity: Major
Found in Backoffice/Security/Authorization/Voter/SiteAdministrationVoter.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return $this->canActOnSite($subject->getSite()->getSiteId(), $user);
Severity: Major
Found in Backoffice/Security/Authorization/Voter/SiteAdministrationVoter.php - About 30 mins to fix

Function transform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function transform($site, array $params = array())
    {
        if (!$site instanceof SiteInterface) {
            throw new TransformerParameterTypeException();
        }
Severity: Minor
Found in ApiBundle/Transformer/SiteTransformer.php - About 25 mins 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 newAction has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 _generateFieldColumn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _generateFieldColumn() {
        let columnsDefinition = [];
        let fields = this._contentType.get('fields');
        if (typeof fields !== "undefined") {
            for (let field of fields) {

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

    _generateListableColumn() {
        let columnsDefinition = [];
        let defaultListable = this._contentType.get('default_listable');
        let createdCell = {
            'linked_to_site': BooleanFormatter.getType(),

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

    _displayError(error) {
        if (('ApiError' === error.name || 'ServerError' === error.name) && error.statusCode === 401) {
            window.location.pathname = Routing.generate('fos_user_security_login', true);
        } else {
            let type = ('ApiError' === error.name) ? 'warning' : 'danger';

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

    public function displayUsedReferences(SymfonyStyle $io, array $usedReferences)
    {
        foreach ($usedReferences as $usedReference) {
            $entity = $usedReference['entity'];
            $io->comment('Entity <info>'.$entity->getName(). ' is used in :');
Severity: Minor
Found in Backoffice/Command/OrchestraDeleteSiteTools.php - About 25 mins 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 formAction has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 6 (exceeds 5 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 25 mins 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 _transformTransitions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    _transformTransitions(workflowProfiles) {
        let transitions = [];
        for (let workflowProfile of workflowProfiles) {
            if (workflowProfile.has('transitions')) {
                for (let transition of workflowProfile.get('transitions').models) {

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 formAction has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 addReferencesToEntity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function addReferencesToEntity($entity)
    {
        if ($this->support($entity)) {
            $keywordIds = $this->extractKeywordsFromContentType($entity);

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

    protected function extractKeywordsFromContentType(ContentTypeInterface $contentType)
    {
        $keywordIds = array();
        $fields = $contentType->getFields();

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