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 = [];
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");
- Read upRead up
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 = [];
- Read upRead up
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 = '/';
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 = [];
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\\';
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");
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;
- Read upRead up
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;
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;
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" />
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');
- Read upRead up
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;
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');
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('');
Method getDelete
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDelete()
{
$item_names = request('items');
$errors = [];
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"))
);
- Read upRead up
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;
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');
- Read upRead up
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');