GrafiteInc/CMS

View on GitHub

Showing 60 of 103 total issues

File mimes.php has 642 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * --------------------------------------------------------------------------
 * Mimes
Severity: Major
Found in src/Assets/mimes.php - About 1 day to fix

    Function asHtml has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        public function asHtml($config)
        {
            $class = $config['class'];
            $dates = $config['dates'];
    
    
    Severity: Minor
    Found in src/Services/EventService.php - About 5 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

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

        public function handle()
        {
            $this->filesystem = new Filesystem();
            $crudGenerator = new CrudGenerator();
    
    
    Severity: Major
    Found in src/Console/ModuleCrud.php - About 4 hrs to fix

      Function menu has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public function menu($slug, $view = null, $class = '')
          {
              $pageRepository = app(PageRepository::class);
              $menu = app(MenuRepository::class)->getBySlug($slug);
      
      
      Severity: Minor
      Found in src/Services/Traits/MenuServiceTrait.php - About 4 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 cms.php has 335 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /*
       * --------------------------------------------------------------------------
       * Grafite CMS Config
      Severity: Minor
      Found in src/PublishedAssets/Config/cms.php - About 4 hrs to fix

        Function handle has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function handle()
            {
                if (is_dir(base_path(Config::get('cms.module-directory')).DIRECTORY_SEPARATOR.ucfirst($this->argument('module')).DIRECTORY_SEPARATOR.'Publishes')) {
                    $fileSystem = new Filesystem();
        
        
        Severity: Minor
        Found in src/Console/ModulePublish.php - About 3 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

        Function afterCreate has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function afterCreate($payload)
            {
                if (config('cms.auto-translate', false)) {
                    $entry = $payload->toArray();
        
        
        Severity: Minor
        Found in src/Traits/Translatable.php - About 3 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

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

            public function handle()
            {
                $crudGenerator = new CrudGenerator();
        
                $name = ucfirst(str_singular($this->argument('name')));
        Severity: Major
        Found in src/Console/ModuleMake.php - About 3 hrs to fix

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

              public function boot()
              {
                  $this->publishes([
                      __DIR__.'/PublishedAssets/Views/themes' => base_path('resources/themes'),
                      __DIR__.'/PublishedAssets/Controllers' => app_path('Http/Controllers/Cms'),
          Severity: Major
          Found in src/GrafiteCmsProvider.php - About 2 hrs to fix

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

                public function setSchema()
                {
                    if ($this->option('schema')) {
                        $migrationFiles = $this->filesystem->allFiles(base_path('cms/Modules/'.ucfirst(str_plural($this->table)).'/Migrations'));
                        $migrationName = 'create_'.str_plural(strtolower($this->table)).'_table';
            Severity: Minor
            Found in src/Console/ModuleCrud.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

            Method asHtml has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function asHtml($config)
                {
                    $class = $config['class'];
                    $dates = $config['dates'];
            
            
            Severity: Minor
            Found in src/Services/EventService.php - About 1 hr to fix

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

                  public function menu($slug, $view = null, $class = '')
                  {
                      $pageRepository = app(PageRepository::class);
                      $menu = app(MenuRepository::class)->getBySlug($slug);
              
              
              Severity: Minor
              Found in src/Services/Traits/MenuServiceTrait.php - About 1 hr to fix

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

                    public function handle()
                    {
                        $name = $this->argument('name');
                
                        $fileSystem = new Filesystem();
                Severity: Minor
                Found in src/Console/ThemePublish.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 handle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function handle()
                    {
                        $moduleDir = base_path(config('cms.module-directory')).'/'.ucfirst($this->argument('module'));
                        if (is_dir($moduleDir)) {
                            $readMeStub = file_get_contents(__DIR__.'/../Templates/Composer/readme.stub');
                Severity: Minor
                Found in src/Console/ModuleComposer.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 saveFile has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function saveFile($fileName, $directory = '', $fileTypes = [], $isImage = false)
                    {
                        if (is_object($fileName)) {
                            $file = $fileName;
                            $originalName = $file->getClientOriginalName();
                Severity: Minor
                Found in src/Services/FileService.php - About 1 hr to fix

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

                      public function handle()
                      {
                          $name = $this->argument('name');
                  
                          $fileSystem = new Filesystem();
                  Severity: Minor
                  Found in src/Console/ThemeGenerate.php - About 1 hr to fix

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

                        public function handle()
                        {
                            if (is_dir(base_path(Config::get('cms.module-directory')).DIRECTORY_SEPARATOR.ucfirst($this->argument('module')).DIRECTORY_SEPARATOR.'Publishes')) {
                                $fileSystem = new Filesystem();
                    
                    
                    Severity: Minor
                    Found in src/Console/ModulePublish.php - About 1 hr to fix

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

                          public function menus()
                          {
                              $modulePath = base_path(config('cms.module-directory').'/');
                              $modules = glob($modulePath.'*');
                      
                      
                      Severity: Minor
                      Found in src/Services/ModuleService.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 check has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function check($form, $jsonInput = false)
                          {
                              $result = [];
                              $errors = [];
                              $inputs = [];
                      Severity: Minor
                      Found in src/Services/ValidationService.php - About 1 hr to fix

                        Method afterCreate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function afterCreate($payload)
                            {
                                if (config('cms.auto-translate', false)) {
                                    $entry = $payload->toArray();
                        
                        
                        Severity: Minor
                        Found in src/Traits/Translatable.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language