UniSharp/laravel-filemanager

View on GitHub

Showing 27 of 35 total issues

File script.js has 651 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var lfm_route = location.origin + location.pathname;
var show_list;
var sort_type = 'alphabetic';
var multi_selection_enabled = false;
var selected = [];
Severity: Major
Found in public/js/script.js - About 1 day to fix

    Function use has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    function use(items) {
      function useTinymce3(url) {
        if (!usingTinymce3()) { return; }
    
        var win = tinyMCEPopup.getWindowArg("window");
    Severity: Minor
    Found in public/js/script.js - 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

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

        public function getDelete()
        {
            $item_names = request('items');
            $errors = [];
    
    
    Severity: Minor
    Found in src/Controllers/DeleteController.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

    Lfm has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Lfm
    {
        const PACKAGE_NAME = 'laravel-filemanager';
        const DS = '/';
    
    
    Severity: Minor
    Found in src/Lfm.php - About 3 hrs to fix

      Function loadItems has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function loadItems(page) {
        loading(true);
        performLfmRequest('jsonitems', {show_list: show_list, sort_type: sort_type, page: page || 1}, 'html')
          .done(function (data) {
            selected = [];
      Severity: Major
      Found in public/js/script.js - About 3 hrs to fix

        Method routes has 74 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function routes()
            {
                $middleware = [ CreateDefaultFolder::class, MultiUser::class ];
                $as = 'unisharp.lfm.';
                $namespace = '\\UniSharp\\LaravelFilemanager\\Controllers\\';
        Severity: Major
        Found in src/Lfm.php - About 2 hrs to fix

          Function use has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function use(items) {
            function useTinymce3(url) {
              if (!usingTinymce3()) { return; }
          
              var win = tinyMCEPopup.getWindowArg("window");
          Severity: Major
          Found in public/js/script.js - About 2 hrs to fix

            Function generatePaginationHTML has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            function generatePaginationHTML(el, args) {
              var template = '<li class="page-item"><\/li>';
              var linkTemplate = '<a class="page-link"><\/a>';
              var currentPage = args.currentPage;
              var totalPage = args.totalPage;
            Severity: Minor
            Found in public/js/script.js - 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

            LfmPath has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class LfmPath
            {
                private $working_dir;
                private $item_name;
                private $is_thumb = false;
            Severity: Minor
            Found in src/LfmPath.php - About 2 hrs to fix

              Function generatePaginationHTML has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function generatePaginationHTML(el, args) {
                var template = '<li class="page-item"><\/li>';
                var linkTemplate = '<a class="page-link"><\/a>';
                var currentPage = args.currentPage;
                var totalPage = args.totalPage;
              Severity: Major
              Found in public/js/script.js - About 2 hrs to fix

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

                <!DOCTYPE html>
                <html lang="en">
                <head>
                  <meta charset="UTF-8">
                  <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
                Severity: Minor
                Found in src/views/index.blade.php - About 2 hrs to fix

                  Function getRename has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getRename()
                      {
                          $old_name = $this->helper->input('file');
                          $new_name = $this->helper->input('new_name');
                  
                  
                  Severity: Minor
                  Found in src/Controllers/RenameController.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 Lfm.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  namespace UniSharp\LaravelFilemanager;
                  
                  use Illuminate\Contracts\Config\Repository as Config;
                  Severity: Minor
                  Found in src/Lfm.php - About 2 hrs to fix

                    Method getRename has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getRename()
                        {
                            $old_name = $this->helper->input('file');
                            $new_name = $this->helper->input('new_name');
                    
                    
                    Severity: Minor
                    Found in src/Controllers/RenameController.php - About 1 hr to fix

                      Function preview has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function preview(items) {
                        var carousel = $('#carouselTemplate').clone().attr('id', 'previewCarousel').removeClass('d-none');
                        var imageTemplate = carousel.find('.carousel-item').clone().removeClass('active');
                        var indicatorTemplate = carousel.find('.carousel-indicators > li').clone().removeClass('active');
                        carousel.children('.carousel-inner').html('');
                      Severity: Minor
                      Found in public/js/script.js - About 1 hr to fix

                        Method getDelete has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getDelete()
                            {
                                $item_names = request('items');
                                $errors = [];
                        
                        
                        Severity: Minor
                        Found in src/Controllers/DeleteController.php - About 1 hr to fix

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

                              private function getNewName($file)
                              {
                                  $new_file_name = $this->helper->translateFromUtf8(
                                      trim($this->helper->utf8Pathinfo($file->getClientOriginalName(), "filename"))
                                  );
                          Severity: Minor
                          Found in src/LfmPath.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 upload has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function upload()
                              {
                                  $uploaded_files = request()->file('upload');
                                  $error_bag = [];
                                  $new_filename = null;
                          Severity: Minor
                          Found in src/Controllers/UploadController.php - About 1 hr to fix

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

                                public function doMove()
                                {
                                    $target = $this->helper->input('goToFolder');
                                    $items = $this->helper->input('items');
                            
                            
                            Severity: Minor
                            Found in src/Controllers/ItemsController.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 getResize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getResize()
                                {
                                    $ratio = 1.0;
                                    $image = request('img');
                            
                            
                            Severity: Minor
                            Found in src/Controllers/ResizeController.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language