open-orchestra/open-orchestra-front-bundle

View on GitHub

Showing 32 of 32 total issues

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

<?php

namespace OpenOrchestra\FrontBundle\Tests\Command;

use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractBaseTestCase;
FrontBundle/Tests/Command/OrchestraGenerateErrorPagesCommandTest.php on lines 1..56

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 159.

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

<?php

namespace OpenOrchestra\FrontBundle\Tests\Command;

use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractBaseTestCase;
FrontBundle/Tests/Command/OrchestraGenerateSitemapCommandTest.php on lines 1..57

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 159.

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 execute(InputInterface $input, OutputInterface $output)
    {
        if ($siteId = $input->getOption('siteId')) {
            $site = $this->getContainer()->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
            if ($site) {
Severity: Major
Found in FrontBundle/Command/OrchestraGenerateRobotsCommand.php and 1 other location - About 3 hrs to fix
FrontBundle/Command/OrchestraGenerateSitemapCommand.php on lines 32..55

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 158.

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 execute(InputInterface $input, OutputInterface $output)
    {
        if ($siteId = $input->getOption('siteId')) {
            $site = $this->getContainer()->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
            if ($site) {
Severity: Major
Found in FrontBundle/Command/OrchestraGenerateSitemapCommand.php and 1 other location - About 3 hrs to fix
FrontBundle/Command/OrchestraGenerateRobotsCommand.php on lines 36..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 158.

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 2 locations. Consider refactoring.
Open

    public function testGetRouteCollection()
    {
        $routeDocument = Phake::mock('OpenOrchestra\ModelInterface\Model\RouteDocumentInterface');
        $routeDocuments = new ArrayCollection(array($routeDocument));
        Phake::when($this->routeDocumentRepository)->findAll()->thenReturn($routeDocuments);
FrontBundle/Tests/Routing/Database/OpenOrchestraDatabaseRouterTest.php on lines 74..86

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 123.

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 2 locations. Consider refactoring.
Open

    public function testGetRouteCollection()
    {
        $routeDocument = Phake::mock('OpenOrchestra\ModelInterface\Model\RouteDocumentInterface');
        $routeDocuments = new ArrayCollection(array($routeDocument));
        Phake::when($this->routeDocumentRepository)->findAll()->thenReturn($routeDocuments);
FrontBundle/Tests/Routing/Database/OpenOrchestraDatabaseLinkRouterTest.php on lines 66..78

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 123.

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

    public function provideNode()
    {
        $maxAge = array(
            'block1' => 75,
            'block2' => 125,
Severity: Major
Found in FrontBundle/Tests/Manager/NodeResponseManagerTest.php - About 2 hrs to fix

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

    public function testGetPathNode()
    {
        $id = 'fakeId';
        $nodeId = 'nodeId';
        $node = Phake::mock(ReadNodeInterface::class);
Severity: Major
Found in FrontBundle/Tests/Twig/RoutingNodeExtensionTest.php and 1 other location - About 2 hrs to fix
FrontBundle/Tests/Twig/RoutingNodeExtensionTest.php on lines 92..103

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 121.

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

    public function testGetUrlNode()
    {
        $id = 'fakeId';
        $nodeId = 'nodeId';
        $node = Phake::mock(ReadNodeInterface::class);
Severity: Major
Found in FrontBundle/Tests/Twig/RoutingNodeExtensionTest.php and 1 other location - About 2 hrs to fix
FrontBundle/Tests/Twig/RoutingNodeExtensionTest.php on lines 64..75

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 121.

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

    public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
    {
        $request = $this->requestStack->getMasterRequest();
        if (isset($parameters[self::REDIRECT_TO_LANGUAGE])) {
            try {
Severity: Minor
Found in FrontBundle/Routing/Database/OpenOrchestraDatabaseUrlGenerator.php - About 1 hr to fix

Function generate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
    {
        $request = $this->requestStack->getMasterRequest();
        if (isset($parameters[self::REDIRECT_TO_LANGUAGE])) {
            try {
Severity: Minor
Found in FrontBundle/Routing/Database/OpenOrchestraDatabaseUrlGenerator.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 setCurrentSiteInfo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function setCurrentSiteInfo($host, $path)
    {
        $path = $this->formatPath($path);
        $currentSiteId = null;
        $currentLanguage = null;
Severity: Minor
Found in FrontBundle/EventSubscriber/KernelExceptionSubscriber.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 provideDataToVote has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function provideDataToVote()
    {
        return array(
            array(
                Phake::mock('OpenOrchestra\ModelInterface\Model\ReadNodeInterface'),
Severity: Minor
Found in FrontBundle/Tests/Security/Authorization/Voter/NodeVoterTest.php - About 1 hr to fix

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

    public function setUp()
    {
        $this->updatedDate = new \DateTime();
        $this->nodeRepository = Phake::mock('OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface');
        $this->node = Phake::mock('OpenOrchestra\ModelInterface\Model\ReadNodeInterface');
Severity: Minor
Found in FrontBundle/Tests/Manager/SitemapManagerTest.php - About 1 hr to fix

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

    public function setUp()
    {
        $this->mainAlias = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteAliasInterface');
        Phake::when($this->mainAlias)->getLanguage()->thenReturn($this->currentLanguage);
        $this->site = Phake::mock('OpenOrchestra\ModelInterface\Model\ReadSiteInterface');
Severity: Minor
Found in FrontBundle/Tests/EventSubscriber/KernelExceptionSubscriberTest.php - About 1 hr to fix

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

    protected function setCurrentSiteInfo($host, $path)
    {
        $path = $this->formatPath($path);
        $currentSiteId = null;
        $currentLanguage = null;
Severity: Minor
Found in FrontBundle/EventSubscriber/KernelExceptionSubscriber.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)
    {
        $context = $this->getContainer()->get('router')->getContext();
        $context->setBaseUrl('');

Severity: Minor
Found in FrontBundle/Command/OrchestraGenerateErrorPagesCommand.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 ($siteId = $input->getOption('siteId')) {
            $site = $this->getContainer()->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
            if ($site) {
Severity: Minor
Found in FrontBundle/Command/OrchestraGenerateSitemapCommand.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 generate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function generate(ReadBlockInterface $block, array $baseSubQuery)
    {
        $blockPrivate = !$this->displayBlockManager->isPublic($block);
        $blockParameters = $this->displayBlockManager->getBlockParameter($block);
        $subQuery = array_merge($baseSubQuery, $this->generateSubQueryCache($blockPrivate));
Severity: Minor
Found in FrontBundle/SubQuery/SubQueryGeneratorManager.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 ($siteId = $input->getOption('siteId')) {
            $site = $this->getContainer()->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
            if ($site) {
Severity: Minor
Found in FrontBundle/Command/OrchestraGenerateRobotsCommand.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