Showing 71 of 115 total issues
Function maximize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
value: function maximize() {
if (!this.isMaximized) {
// Store modal data before maximize
this.modalData = {
width: this.$photoviewer.width(),
Function dragStart
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
var dragStart = function dragStart(dir, e) {
e = e || window.event;
e.preventDefault();
isDragging = true;
PUBLIC_VARS['isResizing'] = true;
Function D3FilesPreview
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.D3FilesPreview = function () {
this.gridSelector = '#ThGridViewTable tbody';
this.handlers = {
previewButton: $('.d3files-preview-widget-load'),
previewDropdown: $('.d3files-preview-dropdown'),
Method renderDataCellContent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderDataCellContent($model, $key, $index): string
{
try {
if (empty($this->recordsWithFiles[$model->id])) {
return '';
Function on
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var on = function (event, selector, data, callback, one) {
var autoRemove, delegator, $this = this;
if (event && !isString(event)) {
D.each(event, function (type, fn) {
$this.on(type, selector, data, fn, one);
Method init
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function init(): void
{
if (!$this->viewByExtensions) {
$this->viewByExtensions = D3Files::getAllowedFileTypes();
}
Method createSharedModel
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSharedModel($id, $expireDays = null, $leftLoadings = null)
{
if (!$hashSalt = Yii::$app->getModule('d3files')->hashSalt) {
return false;
Method getViewParams
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getViewParams(): ?array
{
$params = [
'showPrevNext' => $this->showPrevNext,
'viewType' => $this->viewType,
Function loadImage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
value: function loadImage(imgSrc, fn, err) {
var _this3 = this;
// Reset image
this.$image.removeAttr('style').attr('src', '');
Function add
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function add(element, events, fn, data, selector, delegator, capture) {
var id = zid(element), set = (handlers[id] || (handlers[id] = []));
events.split(/\s/).forEach(function (event) {
if (event == 'ready') return D(document).ready(fn);
var handler = parse(event);
Function uploadFile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function uploadFile(file, widget) {
"use strict";
let form;
let fileInputName;
let tbl;
- 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 add
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function add(element, events, fn, data, selector, delegator, capture) {
Function actionRemoveFiles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function actionRemoveFiles(string $modelName): int
{
$modelMN = new D3filesModelName();
if (!$modelNameId = $modelMN->getByName($modelName, false)) {
$this->out('Illegal model name: ' . $modelName);
- 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 saveFile
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function saveFile(string $fileName,string $modelName,int $modelId,string $filePath,string $fileTypes,?int $userId = 0): void
Function getViewParams
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getViewParams(): ?array
{
$params = [
'showPrevNext' => $this->showPrevNext,
'viewType' => $this->viewType,
- 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
Avoid deeply nested control flow statements. Open
if (copyIsArray) {
copyIsArray = false;
clone = src && isArray(src) ? src : [];
} else {
clone = src && isPlainObject(src) ? src : {};
Avoid deeply nested control flow statements. Open
} else if (copy !== undefined) {
target[name] = copy;
}
Method saveContent
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function saveContent(string $fileName,string $modelName,int $modelId,string $fileContent,string $fileTypes,?int $userId = 0): void
Function animate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var animate = function (properties, duration, ease, callback, delay) {
Function on
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var on = function (event, selector, data, callback, one) {