Starbugstone/SnowTricks

View on GitHub

Showing 30 of 33 total issues

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

<?php

namespace App\Controller\Media;

use App\Entity\Video;
Severity: Major
Found in src/Controller/Media/DeleteVideoController.php and 1 other location - About 5 hrs to fix
src/Controller/Media/DeleteImageController.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 189.

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 App\Controller\Media;

use App\Entity\Image;
Severity: Major
Found in src/Controller/Media/DeleteImageController.php and 1 other location - About 5 hrs to fix
src/Controller/Media/DeleteVideoController.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 189.

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(addImageHolder){
    addImageHolder.insertAdjacentElement('afterend', createShowButton(addImageHolder, 'add Image'));

    //adding the delete button on existing elements
    const imageElements = document.querySelectorAll('#trick_form_images>div>div');
Severity: Major
Found in assets/js/symfonyCollectionType.js and 1 other location - About 2 hrs to fix
assets/js/symfonyCollectionType.js on lines 15..22

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

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(addVideoHolder){
    addVideoHolder.insertAdjacentElement('afterend', createShowButton(addVideoHolder, 'add video'));
    //adding the delete button on existing elements
    const imageElements = document.querySelectorAll('#trick_form_videos>div>div');
    imageElements.forEach(function(elem){
Severity: Major
Found in assets/js/symfonyCollectionType.js and 1 other location - About 2 hrs to fix
assets/js/symfonyCollectionType.js on lines 3..11

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

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

document.addEventListener('DOMContentLoaded', function () {
    var elems = document.querySelectorAll('select');
    if (elems.length === 0) {
        return;
    }
Severity: Major
Found in assets/js/materializeInitialisers.js and 1 other location - About 1 hr to fix
assets/js/materializeInitialisers.js on lines 11..18

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

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

document.addEventListener('DOMContentLoaded', function () {
    var elems = document.querySelectorAll('.materialboxed');
    if (elems.length === 0) {
        return;
    }
Severity: Major
Found in assets/js/materializeInitialisers.js and 1 other location - About 1 hr to fix
assets/js/materializeInitialisers.js on lines 2..8

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

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

<?php

namespace App\EventSubscriber\Video;

use App\Event\Video\VideoDeleteEvent;
Severity: Major
Found in src/EventSubscriber/Video/VideoDeletedSubscriber.php and 2 other locations - About 1 hr to fix
src/EventSubscriber/Image/ImageDeletedSubscriber.php on lines 1..39
src/EventSubscriber/Video/VideoAddedSubscriber.php on lines 1..38

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

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

<?php

namespace App\EventSubscriber\Image;


Severity: Major
Found in src/EventSubscriber/Image/ImageDeletedSubscriber.php and 2 other locations - About 1 hr to fix
src/EventSubscriber/Video/VideoAddedSubscriber.php on lines 1..38
src/EventSubscriber/Video/VideoDeletedSubscriber.php on lines 1..38

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

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

<?php

namespace App\EventSubscriber\Video;

use App\Event\Video\VideoAddEvent;
Severity: Major
Found in src/EventSubscriber/Video/VideoAddedSubscriber.php and 2 other locations - About 1 hr to fix
src/EventSubscriber/Image/ImageDeletedSubscriber.php on lines 1..39
src/EventSubscriber/Video/VideoDeletedSubscriber.php on lines 1..38

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

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

    public function search(Request $request, $categoryId = "", $slug = "")
    {
        $category = null;
        if ($categoryId !== "") {
            $category = $this->categoryRepository->find($categoryId);
Severity: Minor
Found in src/Controller/Trick/TricksByCategoryController.php - About 1 hr to fix

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

    <?php
    
    namespace App\Repository;
    
    use App\Entity\Video;
    Severity: Major
    Found in src/Repository/VideoRepository.php and 1 other location - About 1 hr to fix
    src/Repository/ImageRepository.php on lines 1..66

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

    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 App\Repository;
    
    use App\Entity\Image;
    Severity: Major
    Found in src/Repository/ImageRepository.php and 1 other location - About 1 hr to fix
    src/Repository/VideoRepository.php on lines 1..66

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

    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 App\Repository;
    
    use App\Entity\Category;
    Severity: Major
    Found in src/Repository/CategoryRepository.php and 1 other location - About 1 hr to fix
    src/Repository/TagRepository.php on lines 1..38

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

    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 App\Repository;
    
    use App\Entity\Tag;
    Severity: Major
    Found in src/Repository/TagRepository.php and 1 other location - About 1 hr to fix
    src/Repository/CategoryRepository.php on lines 1..37

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

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

        public function showTricksByTag(Request $request, Tag $tag, string $slug)
        {
            if ($tag->getSlug() !== $slug) {
                return $this->correctSlug($tag);
            }
    Severity: Minor
    Found in src/Controller/Trick/TricksByTagController.php - About 1 hr to fix

      Function setPrimaryImage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function setPrimaryImage(image) {
      
          let primaryImageLoader = document.querySelector('#primary-image-preloader');
          let primaryImage = document.querySelector('#trick-primary-image');
      
      
      Severity: Minor
      Found in assets/js/axiosCalls.js - About 1 hr to fix

        Function addEditForm has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Window.prototype.addEditForm =  function(e, linkElement){
            e.preventDefault();
        
            let commentId = linkElement.dataset.commentid;
            let url = linkElement.href;
        Severity: Minor
        Found in assets/js/axiosCalls.js - About 1 hr to fix

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

              public function searchTricks(string $query)
              {
          
                  $query = $this->sanitizeSearchQuery($query);
                  $searchTerms = $this->extractSearchTerms($query);
          Severity: Minor
          Found in src/Search/TrickSearch.php - About 1 hr to fix

            Method buildForm has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function buildForm(FormBuilderInterface $builder, array $options)
                {
                    $builder
                        ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event){
                            $video = $event->getData();
            Severity: Minor
            Found in src/Form/VideoFormType.php - About 1 hr to fix

              Method edit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function edit(Trick $trick, Request $request)
                  {
                      $originalTrickImages = $trick->getImages()->count();
                      /** @var Form $form */
                      $form = $this->createForm(TrickFormType::class, $trick, [
              Severity: Minor
              Found in src/Controller/Trick/Admin/EditTrickController.php - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language