open-orchestra/open-orchestra-model-bundle

View on GitHub

Showing 72 of 72 total issues

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

    public function transformSubConditionToMongoCondition($condition, array &$aliases)
    {
        $elements = array();
        $subElements = array();
        $operator = '$and';
Severity: Minor
Found in ModelBundle/Repository/RepositoryTrait/KeywordableTrait.php - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if (null !== $dateAfter && '' !== $dateAfter) {
            $dateFormatAfter = $configuration->getSearchIndex('date-format-after');
            if (null !== $dateFormatAfter && '' !== $dateFormatAfter) {
                $dateAfter = $this->getFormattedDate($dateAfter, $dateFormatAfter);
                $qa->match(array('deletedAt' => array('$gt' => new \MongoDate(strtotime($dateAfter)))));
Severity: Major
Found in ModelBundle/Repository/TrashItemRepository.php and 1 other location - About 1 hr to fix
ModelBundle/Repository/TrashItemRepository.php on lines 104..110

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 104.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if (null !== $dateBefore && '' !== $dateBefore) {
            $dateFormatBefore = $configuration->getSearchIndex('date-format-before');
            if (null !== $dateFormatBefore && '' !== $dateFormatBefore) {
                $dateBefore = $this->getFormattedDate($dateBefore, $dateFormatBefore);
                $qa->match(array('deletedAt' => array('$lt' => new \MongoDate(strtotime($dateBefore)))));
Severity: Major
Found in ModelBundle/Repository/TrashItemRepository.php and 1 other location - About 1 hr to fix
ModelBundle/Repository/TrashItemRepository.php on lines 113..119

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 104.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    public function prePersist(LifecycleEventArgs $event)
    {
        $document = $event->getDocument();
        $className = get_class($document);
        $generateAnnotations = $this->annotationReader->getClassAnnotation(new \ReflectionClass($className), 'OpenOrchestra\Mapping\Annotations\Document');
Severity: Minor
Found in ModelBundle/EventListener/GenerateIdListener.php - About 1 hr to fix

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

    public function load(ObjectManager $objectManager)
    {
        for ($i = 0; $i < 250 ; $i++) {
            $objectManager->persist($this->generateNews($i, 1, 'fr'));
            // Versions
Severity: Minor
Found in ModelBundle/DataFixtures/MongoDB/LoadContentThousandData.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 execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {

        if (!is_null($input->getOption('type'))) {
            $type = $input->getOption('type');
Severity: Minor
Found in ModelBundle/Command/OrchestraLoadDataFixturesDoctrineODMCommand.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 filterSearch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa, $siteId)
    {
        $qa->match(array('siteId' => $siteId));

        $name = $configuration->getSearchIndex('name');
Severity: Minor
Found in ModelBundle/Repository/TrashItemRepository.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 setPath has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setPath(LifecycleEventArgs $eventArgs)
    {
        $document = $eventArgs->getDocument();
        if ($document instanceof NodeInterface && false === $document->isDeleted()) {
            $nodeRepository = $this->container->get('open_orchestra_model.repository.node');
Severity: Minor
Found in ModelBundle/EventListener/GeneratePathListener.php - About 1 hr to fix

Function setPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function setPath(LifecycleEventArgs $eventArgs)
    {
        $document = $eventArgs->getDocument();
        if ($document instanceof NodeInterface && false === $document->isDeleted()) {
            $nodeRepository = $this->container->get('open_orchestra_model.repository.node');
Severity: Minor
Found in ModelBundle/EventListener/GeneratePathListener.php - About 55 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

Method findByHistoryAndSiteId has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $id,
        $siteId,
        array $eventTypes = null,
        $published = null,
        $limit = null,
Severity: Major
Found in ModelBundle/Repository/ContentRepository.php - About 50 mins to fix

Method removeBlockInArea has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function removeBlockInArea($blockId, $areaName, $nodeId, $siteId, $language, $version)
Severity: Minor
Found in ModelBundle/Repository/NodeRepository.php - About 45 mins to fix

Method generateContent has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function generateContent($type, $id, $name, $language, $version, $deleted)
Severity: Minor
Found in ModelBundle/DataFixtures/MongoDB/LoadContentThousandData.php - About 45 mins to fix

Method addNewsAttributes has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function addNewsAttributes($news, $title, $start, $end, $intro, $text)
Severity: Minor
Found in ModelBundle/DataFixtures/MongoDB/LoadContentNewsData.php - About 45 mins to fix

Method findByHistoryAndSiteId has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function findByHistoryAndSiteId($id, $siteId, array $eventTypes = null, $published = null, $limit = null, array $sort = null)
Severity: Minor
Found in ModelBundle/Repository/NodeRepository.php - About 45 mins to fix

Function isTransient has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function isTransient($className)
    {
        $parentCheck = parent::isTransient($className);

        if (true == $parentCheck) {
Severity: Minor
Found in ModelBundle/DataFixtures/Loader/OrchestraContainerAwareLoader.php - About 45 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

Identical blocks of code found in 4 locations. Consider refactoring.
Open

    public function findForPaginate(PaginateFinderConfiguration $configuration)
    {
        $qa = $this->createAggregationQuery();

        $this->filterSearch($configuration, $qa);
Severity: Major
Found in ModelBundle/Repository/RedirectionRepository.php and 3 other locations - About 40 mins to fix
ModelBundle/Repository/KeywordRepository.php on lines 42..57
ModelBundle/Repository/StatusRepository.php on lines 126..141
ModelBundle/Repository/WorkflowProfileRepository.php on lines 44..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

    public function findForPaginate(PaginateFinderConfiguration $configuration)
    {
        $qa = $this->createAggregationQuery();

        $this->filterSearch($configuration, $qa);
Severity: Major
Found in ModelBundle/Repository/KeywordRepository.php and 3 other locations - About 40 mins to fix
ModelBundle/Repository/RedirectionRepository.php on lines 54..69
ModelBundle/Repository/StatusRepository.php on lines 126..141
ModelBundle/Repository/WorkflowProfileRepository.php on lines 44..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

    public function findForPaginate(PaginateFinderConfiguration $configuration)
    {
        $qa = $this->createAggregationQuery();

        $this->filterSearch($configuration, $qa);
Severity: Major
Found in ModelBundle/Repository/WorkflowProfileRepository.php and 3 other locations - About 40 mins to fix
ModelBundle/Repository/KeywordRepository.php on lines 42..57
ModelBundle/Repository/RedirectionRepository.php on lines 54..69
ModelBundle/Repository/StatusRepository.php on lines 126..141

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

    public function findForPaginate(PaginateFinderConfiguration $configuration)
    {
        $qa = $this->createAggregationQuery();

        $this->filterSearch($configuration, $qa);
Severity: Major
Found in ModelBundle/Repository/StatusRepository.php and 3 other locations - About 40 mins to fix
ModelBundle/Repository/KeywordRepository.php on lines 42..57
ModelBundle/Repository/RedirectionRepository.php on lines 54..69
ModelBundle/Repository/WorkflowProfileRepository.php on lines 44..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function generateNodeEn()
    {
        $htmlContent = <<<EOF
<div class="content2">
    <h1>&Eacute;diteur</h1>
ModelBundle/DataFixtures/MongoDB/DemoContent/AutoPublishDataGenerator.php on lines 76..100

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language