Showing 14,363 of 14,363 total issues
Function activate
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
activate($element) {
let tags = $element.data('tags');
let prepopulatedTags = $element.val().split(' ');
let context = this;
$element.tokenInput(tags, {
- Create a ticketCreate a ticket
Function _drawGraphic
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
_drawGraphic(transitions , selector) {
var g = new dagreD3.graphlib.Graph().setGraph({});
g.graph().rankdir = 'LR';
for (let transition of transitions) {
- Create a ticketCreate a ticket
Method setUp
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setUp()
{
$this->node = Phake::mock('OpenOrchestra\ModelInterface\Model\NodeInterface');
$this->area = Phake::mock('OpenOrchestra\ModelInterface\Model\AreaInterface');
$this->block = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
- Create a ticketCreate a ticket
Method addFormElements
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addFormElements(FormEvent $event)
{
$form = $event->getForm();
$data = $event->getData();
- Create a ticketCreate a ticket
Method newAction
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function newAction(Request $request, $siteId, $language, $parentId, $order)
{
$order = (int) $order;
$nodeManager = $this->get('open_orchestra_backoffice.manager.node');
$nodeRepository = $this->get('open_orchestra_model.repository.node');
- Create a ticketCreate a ticket
Method testResolver
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testResolver()
{
$this->form->configureOptions($this->resolver);
Phake::verify($this->resolver)->setDefaults(array(
'data_class' => $this->class,
- Create a ticketCreate a ticket
Method buildForm
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('siteId', 'oo_site_choice', array(
'label' => 'open_orchestra_backoffice.form.redirection.site_name',
'group_id' => 'redirection',
- Create a ticketCreate a ticket
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function testGetAvailableSitesWithSuperAdmin()
{
$site1 = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteInterface');
$site2 = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteInterface');
Phake::when($this->siteRepository)->findByDeleted(false)->thenReturn(array($site1, $site2));
- 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 120.
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
if (array_key_exists('source', $params) &&
$params['source'] instanceof NodeInterface &&
null !== $facade->status &&
null !== $facade->status->id &&
$params['source']->getStatus()->getId() !== $facade->status->id
- 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 120.
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
if (array_key_exists('source', $params) &&
$params['source'] instanceof ContentInterface &&
null !== $facade->status &&
null !== $facade->status->id &&
$params['source']->getStatus()->getId() !== $facade->status->id
- 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 120.
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
public function testGetAvailableSitesWithSuperAdmin()
{
$site1 = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteInterface');
$site2 = Phake::mock('OpenOrchestra\ModelInterface\Model\SiteInterface');
Phake::when($this->siteRepository)->findByDeleted(false)->thenReturn(array($site1, $site2));
- 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 120.
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
Method testConfigureOptions
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testConfigureOptions()
{
$resolver = Phake::mock('Symfony\Component\OptionsResolver\OptionsResolver');
$this->blockType->configureOptions($resolver);
- Create a ticketCreate a ticket
Method setUp
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setUp()
{
$this->redirectionClass = 'OpenOrchestra\ModelBundle\Document\Redirection';
$this->contextManager = Phake::mock('OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface');
- Create a ticketCreate a ticket
Method newAction
has 48 lines of code (exceeds 25 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);
- Create a ticketCreate a ticket
Method provideEntityAndNodes
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function provideEntityAndNodes()
{
$blockWithoutNodeId = 'blockWithoutNodeId';
$blockWithoutNode = Phake::mock('OpenOrchestra\ModelInterface\Model\BlockInterface');
Phake::when($blockWithoutNode)->getAttributes()->thenReturn(array());
- Create a ticketCreate a ticket
Method configureOptions
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
array(
'data_class' => null,
- Create a ticketCreate a ticket
Function validate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function validate($value, Constraint $constraint)
{
$parameters = array(
'initial_state' => 0,
'translation_state' => 0,
- 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 preSubmit
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function preSubmit(FormEvent $event)
{
$data = $event->getData();
$user = $event->getForm()->getData();
if ($user instanceof UserInterface) {
- 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 testGetPerimeterConfiguration
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testGetPerimeterConfiguration()
{
$result = $this->strategy->getPerimeterConfiguration('siteId');
$this->assertEquals(array(
- Create a ticketCreate a ticket
Method configureOptions
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => $this->class,
'edit_groups' => true,
- Create a ticketCreate a ticket