Showing 72 of 72 total issues
Method generateContentTypeNews
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateContentTypeNews()
{
$maxLengthOption = $this->generateOption('max_length', 25);
$required = $this->generateOption('required', true);
$dateWidgetOption = $this->generateOption('widget', 'single_text');
- Create a ticketCreate a ticket
Function process
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function process(ContainerBuilder $container)
{
$resourcePath = '.';
foreach ($container->getResources() as $resource) {
- Read upRead up
- Create a ticketCreate a ticket
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 execute
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!is_null($input->getOption('type'))) {
$type = $input->getOption('type');
- Create a ticketCreate a ticket
Method provideDocumentClass
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function provideDocumentClass()
{
return array(
'1' => array("empty", "OpenOrchestra\\ModelBundle\\Document\\Content" , "content" , "OpenOrchestra\\ModelBundle\\Repository\\ContentRepository" , true),
'2' => array("empty", "OpenOrchestra\\ModelBundle\\Document\\ContentAttribute" , "content_attribute" ),
- Create a ticketCreate a ticket
Method provideAnnotations
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function provideAnnotations()
{
$document0 = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');
Phake::when($document0)->getNodeId()->thenReturn(null);
- Create a ticketCreate a ticket
Function prePersist
has a Cognitive Complexity of 12 (exceeds 5 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');
- Read upRead up
- Create a ticketCreate a ticket
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 loadStatus
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
$enName,
$frName,
$name,
$color,
$publishedState = false,
- Create a ticketCreate a ticket
Method generateContentTypeCar
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateContentTypeCar()
{
$maxLengthOption = $this->generateOption('max_length', 25);
$required = $this->generateOption('required', true);
- Create a ticketCreate a ticket
Method load
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
- Create a ticketCreate a ticket
Method generateNodeGlobal
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateNodeGlobal($htmlContent, $language, $routePattern)
{
$nodeHomeBlock = new Block();
$nodeHomeBlock->setLabel('Wysiwyg');
$nodeHomeBlock->setLanguage($language);
- Create a ticketCreate a ticket
Identical blocks of code found in 2 locations. Consider refactoring. Open
protected function addNode(
ObjectManager $manager,
AbstractDataGenerator $dataGenerator,
array $languages = array("fr", "en")
) {
- Read upRead up
- Create a ticketCreate a ticket
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 106.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
protected function addNode(
ObjectManager $manager,
AbstractDataGenerator $dataGenerator,
array $languages = array("fr", "en")
){
- Read upRead up
- Create a ticketCreate a ticket
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 106.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function filterSearch
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa)
{
$siteName = $configuration->getSearchIndex('site_name');
if (null !== $siteName && '' !== $siteName) {
$qa->match(array('siteName' => new \MongoRegex('/.*' . $siteName . '.*/i')));
- Read upRead up
- Create a ticketCreate a ticket
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 load
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
- Read upRead up
- Create a ticketCreate a ticket
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 generateNodeFr
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateNodeFr()
{
$htmlContent = <<<EOF
<div class="contact-information">
<h3>Contactez-nous</h3>
- Create a ticketCreate a ticket
Method findByAliasDomain
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findByAliasDomain($domain)
{
$database = $this->dm->getDocumentDatabase($this->documentName);
$collectionName = $this->dm->getClassMetadata($this->documentName)->collection;
- Create a ticketCreate a ticket
Method generateNodeFr
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateNodeFr()
{
$htmlContent = <<<EOF
<div class='content2'>
<h1>Open-Orchestra</h1>
- Create a ticketCreate a ticket
Method provideNodeForRecord
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function provideNodeForRecord()
{
$node0 = Phake::mock('OpenOrchestra\ModelBundle\Document\Node');
Phake::when($node0)->getNodeId()->thenReturn('fakeId');
Phake::when($node0)->getPath()->thenReturn('fakeParentPath/fakePastId');
- Create a ticketCreate a ticket
Method generateNodeEn
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateNodeEn()
{
$htmlContent = <<<EOF
<div class="contact-information">
<h3>Contact Us</h3>
- Create a ticketCreate a ticket
Method generateNodeDe
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateNodeDe()
{
$htmlContent = <<<EOF
<div class="contact-information">
<h3>Kontaktieren Sie uns</h3>
- Create a ticketCreate a ticket