davide-casiraghi/ci-global-calendar

View on GitHub

Showing 47 of 47 total issues

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

    public function createOrganizersByCountriesChart()
    {
        $organizersByCountries = Organizer::leftJoin('countries', 'organizers.country_id', '=', 'countries.id')
                        ->select(DB::raw('count(*) as organizer_count, countries.name as country_name'))
                        ->groupBy('country_id')
Severity: Major
Found in app/Http/Controllers/StatisticsController.php and 1 other location - About 4 hrs to fix
app/Http/Controllers/StatisticsController.php on lines 175..200

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

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 createTeachersByCountriesChart()
    {
        $teachersByCountries = Teacher::leftJoin('countries', 'teachers.country_id', '=', 'countries.id')
                        ->select(DB::raw('count(*) as teacher_count, countries.name as country_name'))
                        ->groupBy('country_id')
Severity: Major
Found in app/Http/Controllers/StatisticsController.php and 1 other location - About 4 hrs to fix
app/Http/Controllers/StatisticsController.php on lines 209..234

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

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\Mail;

use Illuminate\Bus\Queueable;
Severity: Major
Found in app/Mail/MassMailing.php and 1 other location - About 3 hrs to fix
app/Mail/ContactForm.php on lines 1..50

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

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\Mail;

use Illuminate\Bus\Queueable;
Severity: Major
Found in app/Mail/ContactForm.php and 1 other location - About 3 hrs to fix
app/Mail/MassMailing.php on lines 1..50

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

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

File edit.blade.php has 327 lines of code (exceeds 250 allowed). Consider refactoring.
Open

@extends('donationOffers.layout')


@section('content')
    <div class="container max-w-lg px-0">
Severity: Minor
Found in resources/views/donationOffers/edit.blade.php - About 3 hrs to fix

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

        public function getColumns($postBody)
        {
            // Find plugin occurrences
            $ptn = '/{# +cardsCarousel +(category_id|posts_shown|posts_max_number|show_images|round_images|show_category_title|limit_chars)=\[(.*)\] +(category_id|posts_shown|posts_max_number|show_images|round_images|show_category_title|limit_chars)=\[(.*)\] +(category_id|posts_shown|posts_max_number|show_images|round_images|show_category_title|limit_chars)=\[(.*)\] +(category_id|posts_shown|posts_max_number|show_images|round_images|show_category_title|limit_chars)=\[(.*)\] +(category_id|posts_shown|posts_max_number|show_images|round_images|show_category_title|limit_chars)=\[(.*)\] +(category_id|posts_shown|posts_max_number|show_images|round_images|show_category_title|limit_chars)=\[(.*)\] +(category_id|posts_shown|posts_max_number|show_images|round_images|show_category_title|limit_chars)=\[(.*)\] +#}/';
    
    
    Severity: Major
    Found in app/Classes/CardsCarouselClass.php and 1 other location - About 3 hrs to fix
    app/Classes/ColumnsClass.php on lines 105..133

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

    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 getColumns($postBody)
        {
            // Find plugin occurrences
            $ptn = '/{# +columns +(category_id|show_images|round_images|show_category_title)=\[(.*)\] +(category_id|show_images|round_images|show_category_title)=\[(.*)\] +(category_id|show_images|round_images|show_category_title)=\[(.*)\] +(category_id|show_images|round_images|show_category_title)=\[(.*)\] +#}/';
    
    
    Severity: Major
    Found in app/Classes/ColumnsClass.php and 1 other location - About 3 hrs to fix
    app/Classes/CardsCarouselClass.php on lines 103..133

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

    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

    File create.blade.php has 301 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    @extends('donationOffers.layout')
    
    
    @section('content')
        <div class="container max-w-lg px-0">
    Severity: Minor
    Found in resources/views/donationOffers/create.blade.php - About 3 hrs to fix

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

              if ($searchKeywords || $orientation) {
                  $backgroundImages = DB::table('background_images')
                  ->when($searchKeywords, function ($query, $searchKeywords) {
                      return $query->where('credits', $searchKeywords)->orWhere('credits', 'like', '%'.$searchKeywords.'%');
                  })
      Severity: Major
      Found in app/Http/Controllers/BackgroundImageController.php and 1 other location - About 2 hrs to fix
      app/Http/Controllers/UserController.php on lines 36..47

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

      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 ($searchKeywords || $searchCountry) {
                  $users = DB::table('users')
                     ->when($searchKeywords, function ($query, $searchKeywords) {
                         return $query->where('name', $searchKeywords)->orWhere('name', 'like', '%'.$searchKeywords.'%');
                     })
      Severity: Major
      Found in app/Http/Controllers/UserController.php and 1 other location - About 2 hrs to fix
      app/Http/Controllers/BackgroundImageController.php on lines 28..39

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

      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

      File index.blade.php has 282 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      {{-- @extends('layouts.app') --}}
      @extends('layouts.hpEventSearch')
      
      @section('javascript-document-ready')
          @parent
      Severity: Minor
      Found in resources/views/eventSearch/index.blade.php - About 2 hrs to fix

        Method handle has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function handle($request, Closure $next)
            {
                /* LEFT Menu */
                \Menu::make('MyNavBar', function ($menu) {
                    $profile = $menu->add('home')->link->href('/');
        Severity: Major
        Found in app/Http/Middleware/GenerateMenus.php - About 2 hrs to fix

          Method index has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function index(Request $request)
              {
                  $cacheExpireTime = 900; // expressed in seconds (15 min)
          
                  $backgroundImages = BackgroundImage::all();
          Severity: Minor
          Found in app/Http/Controllers/EventSearchController.php - About 2 hrs to fix

            Method register has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function register(Request $request)
                {
                    /** @var User $user */
            
                    // Validate form datas
            Severity: Minor
            Found in app/Http/Controllers/Auth/RegisterController.php - About 1 hr to fix

              Method createLinesChart has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function createLinesChart($daysRange)
                  {
                      $lastIDUpdatedStats = \DB::table('statistics')->max('id');
              
                      /* Registered users*/
              Severity: Minor
              Found in app/Http/Controllers/StatisticsController.php - About 1 hr to fix

                Method contactFormSend has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function contactFormSend(Request $request)
                    {
                        // Validate form datas
                        /*$validator = Validator::make($request->all(), [
                            'name' => 'required',
                Severity: Minor
                Found in app/Http/Controllers/ContactFormController.php - About 1 hr to fix

                  Method boot has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function boot()
                      {
                          // FIX THE LOCALE BUG WITH CARBON - https://vegibit.com/what-is-a-view-composer-in-laravel/
                          View::composer('*', function ($view) {
                              $locale = App::getLocale();
                  Severity: Minor
                  Found in app/Providers/AppServiceProvider.php - About 1 hr to fix

                    Function getGallery has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getGallery($postBody, $storagePath, $publicPath)
                        {
                            // Find plugin occurrences
                            $ptn = '/{# +gallery +(src|width|height)=\[(.*)\] +(src|width|height)=\[(.*)\] +(src|width|height)=\[(.*)\] +#}/';
                    
                    
                    Severity: Minor
                    Found in app/Classes/GalleryClass.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 prepareCommunityGoals has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function prepareCommunityGoals($parameters)
                        {
                            $ret = "<div class='communityGoals'>";
                    
                            $ret .= "<div class='card'>";
                    Severity: Minor
                    Found in app/Classes/CommunityGoalsClass.php - About 1 hr to fix

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

                          public function getStatsDonate($postBody)
                          {
                              // Find plugin occurrences
                              $ptn = '/{# +stats_donate +(coding_hours|pm_hours|steering_commitee_meetings|languages_number)=\[(.*)\] +(coding_hours|pm_hours|steering_commitee_meetings|languages_number)=\[(.*)\] +(coding_hours|pm_hours|steering_commitee_meetings|languages_number)=\[(.*)\] +(coding_hours|pm_hours|steering_commitee_meetings|languages_number)=\[(.*)\] +#}/';
                      
                      
                      Severity: Major
                      Found in app/Classes/StatsDonateClass.php and 2 other locations - About 1 hr to fix
                      app/Classes/CommunityGoalsClass.php on lines 24..48
                      app/Classes/PaypalButtonClass.php on lines 22..46

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

                      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