davide-casiraghi/movement_meets_life_nova

View on GitHub

Showing 58 of 95 total issues

Method run has 255 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        $countries = [
            ['name' => 'Italy', 'continent_id' => '6', 'code' => 'IT'],
            ['name' => 'United States', 'continent_id' => '3', 'code' => 'US'],
Severity: Major
Found in database/seeders/CountriesTableSeeder.php - About 1 day to fix

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

    @extends('layouts.backend')
    
    @section('title')
        @lang('event.create_new_event')
    @endsection
    Severity: Minor
    Found in resources/views/events/create.blade.php - About 4 hrs to fix

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

      @extends('layouts.backend')
      
      @section('title')
          @lang('views.edit_insight')
      @endsection
      Severity: Minor
      Found in resources/views/insights/edit.blade.php - About 4 hrs to fix

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

        @extends('layouts.backend')
        
        @section('title')
            @lang('event.edit_event')
        @endsection
        Severity: Minor
        Found in resources/views/events/edit.blade.php - About 3 hrs to fix

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

          @extends('layouts.backend')
          
          @section('title')
              @lang('views.edit_post')
          @endsection
          Severity: Minor
          Found in resources/views/posts/edit.blade.php - About 2 hrs to fix

            File EventService.php has 283 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace App\Services;
            
            use App\Helpers\DateHelpers;
            Severity: Minor
            Found in app/Services/EventService.php - About 2 hrs to fix

              Method run has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function run()
                  {
                      // Reset cached roles and permissions
                      app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
              
              
              Severity: Major
              Found in database/seeders/RolesAndPermissionSeeder.php - About 2 hrs to fix

                File repeat-event.blade.php has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                @section('javascript-document-ready')
                    @parent
                
                    {{-- ON LOAD --}}
                
                
                Severity: Minor
                Found in resources/views/partials/events/repeat-event.blade.php - About 2 hrs to fix

                  File CountriesTableSeeder.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  namespace Database\Seeders;
                  
                  use App\Models\Country;
                  Severity: Minor
                  Found in database/seeders/CountriesTableSeeder.php - About 2 hrs to fix

                    Function users has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function users(int $recordsPerPage = null, array $searchParameters = null)
                        {
                            $query = User::orderBy('email', 'asc');
                            $query->with('profile');
                    
                    
                    Severity: Minor
                    Found in app/Repositories/UserRepository.php - About 2 hrs 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

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

                    @extends('layouts.app')
                    
                    @section('title')@lang('static_pages.footer.get_a_treatment')@endsection
                    
                    @section('content')
                    Severity: Minor
                    Found in resources/views/forms/intakeForm.blade.php - About 2 hrs to fix

                      Method getMonthlySelectOptions has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getMonthlySelectOptions(string $date): string
                          {
                              $monthlySelectOptions = [];
                              $date = implode('-', array_reverse(explode('/', $date)));  // Our YYYY-MM-DD date string
                              $unixTimestamp = strtotime($date);  // Convert the date string into a unix timestamp.
                      Severity: Minor
                      Found in app/Services/EventService.php - About 1 hr to fix

                        Method saveMonthlyRepeatDates has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function saveMonthlyRepeatDates(int $eventId, array $monthRepeatDatas, string $startDate, string $repeatUntilDate, string $timeStart, string $timeEnd): void
                            {
                                $month = Carbon::createFromFormat('Y-m-d', $startDate);
                                $end = Carbon::createFromFormat('Y-m-d', $repeatUntilDate);
                                $weekdayArray = [Carbon::MONDAY, Carbon::TUESDAY, Carbon::WEDNESDAY, Carbon::THURSDAY, Carbon::FRIDAY, Carbon::SATURDAY, Carbon::SUNDAY];
                        Severity: Minor
                        Found in app/Repositories/EventRepetitionRepository.php - About 1 hr to fix

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

                              public static function getRepetitionTextString(Event $event, EventRepetition $firstRpDates): string
                              {
                                  $ret = '';
                          
                                  switch ($event->repeat_type) {
                          Severity: Minor
                          Found in app/Services/EventService.php - About 1 hr to fix

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

                                public function prepareImageHtml(?Media $image, array $parameters): string
                                {
                                    if (is_null($image)) {
                                        return "<div class='p-4 bg-yellow-200'>A image with this id has not been found.</div>";
                                    }
                            Severity: Minor
                            Found in app/Services/Snippets/ImageService.php - About 1 hr to fix

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

                                  public function getAll(int $recordsPerPage = null, array $searchParameters = null, string $orderDirection = 'asc')
                                  {
                                      // Upcoming events are shown first
                                      $query = Event::select('events.*', 'event_repetitions.start_repeat', 'event_repetitions.end_repeat')
                                          ->with(['category', 'teachers', 'venue', 'venue.country'])
                              Severity: Minor
                              Found in app/Repositories/EventRepository.php - About 1 hr to fix

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

                                    public function getAll(int $recordsPerPage = null, array $searchParameters = null)
                                    {
                                        $query = Post::orderBy('created_at', 'desc');
                                
                                        if (!is_null($searchParameters)) {
                                Severity: Minor
                                Found in app/Repositories/PostRepository.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 getAll has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function getAll(int $recordsPerPage = null, array $searchParameters = null, string $orderDirection = 'asc')
                                    {
                                        // Upcoming events are shown first
                                        $query = Event::select('events.*', 'event_repetitions.start_repeat', 'event_repetitions.end_repeat')
                                            ->with(['category', 'teachers', 'venue', 'venue.country'])
                                Severity: Minor
                                Found in app/Repositories/EventRepository.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 decodeOnMonthlyKind has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static function decodeOnMonthlyKind(string $onMonthlyKindCode): string
                                    {
                                        $ret = '';
                                        $onMonthlyKindCodeArray = explode('|', $onMonthlyKindCode);
                                        $weekDays = [
                                Severity: Minor
                                Found in app/Services/EventService.php - About 1 hr to fix

                                  Method definition has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function definition()
                                      {
                                          // Facebook data
                                          $publishedOnFacebookOn = $facebookUrl = $facebookBody = null;
                                          if ($this->faker->boolean(50)) {
                                  Severity: Minor
                                  Found in database/factories/InsightFactory.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language