File navigation.ts
has 998 lines of code (exceeds 250 allowed). Consider refactoring. Open
import $ from 'jquery';
import { CommonParams } from './common.ts';
import { Config } from './config.ts';
import { ajaxRemoveMessage, ajaxShowMessage } from './ajax-message.ts';
import updateNavigationWidthConfig from './navigation/updateNavigationWidthConfig.ts';
Function showCurrent
has 176 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showCurrent (): void {
var db = CommonParams.get('db');
var table = CommonParams.get('table');
var autoexpand = $('#pma_navigation_tree').hasClass('autoexpand');
Function ResizeHandler
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ResizeHandler = function () {
/**
* @var {number} panelWidth Used by the collapser to know where to go
* back to when uncollapsing the panel
*/
Function showCurrent
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
function showCurrent (): void {
var db = CommonParams.get('db');
var table = CommonParams.get('table');
var autoexpand = $('#pma_navigation_tree').hasClass('autoexpand');
- 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 ResizeHandler
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
const ResizeHandler = function () {
/**
* @var {number} panelWidth Used by the collapser to know where to go
* back to when uncollapsing the panel
*/
- 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 loadChildNodes
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadChildNodes (isNode, $expandElem, callback): void {
var $destination = null;
var params = null;
if (isNode) {
Function keyup
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
keyup: function (event) {
var $obj = $(this).closest('div.list_container');
var str = '';
if ($(this).val() !== this.defaultValue && $(this).val() !== '') {
$obj.find('div.pageselector').hide();
- 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 keyup
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
keyup: function (event) {
var $obj = $(this).closest('div.list_container');
var str = '';
if ($(this).val() !== this.defaultValue && $(this).val() !== '') {
$obj.find('div.pageselector').hide();
Function treePagination
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function treePagination ($this): void {
var $msgbox = ajaxShowMessage();
var isDbSelector = $this.closest('div.pageselector').is('.dbselector');
var url = 'index.php?route=/navigation';
var params = 'ajax_request=true';
Function setWidth
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.setWidth = function (position): void {
var pos = position;
if (typeof pos !== 'number') {
pos = 240;
}
Function filterStateRestore
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function filterStateRestore (): void {
if (isStorageSupported('sessionStorage')
&& typeof window.sessionStorage.navTreeSearchFilters !== 'undefined'
) {
var searchClauses = JSON.parse(window.sessionStorage.navTreeSearchFilters);
Function expandTreeNode
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function expandTreeNode ($expandElem, callback = undefined): void {
var $children = $expandElem.closest('li').children('div.list_container');
var $icon = $expandElem.find('img');
if ($expandElem.hasClass('loaded')) {
if ($icon.is('.ic_b_plus')) {
Function request
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
FastFilter.Filter.prototype.request = function (): void {
var self = this;
if (self.$this.find('li.fast_filter').find('img.throbber').length === 0) {
self.$this.find('li.fast_filter').append(
$('<div class="throbber"></div>').append(
Function loadAndHighlightTableOrView
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadAndHighlightTableOrView ($dbItem, itemName) {
var $container = $dbItem.children('div.list_container');
var $expander;
var $whichItem = isItemInContainer($container, itemName, 'li.nav_node_table, li.view');
// If item already there in some container
Function findLoadedItem
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function findLoadedItem ($container, name, clazz, doSelect) {
var ret: any = false;
$container.children('ul').children('li').each(function () {
var $li = $(this);
// this is a navigation group, recurse
Function showFullName
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showFullName ($containerELem): void {
$containerELem.find('.hover_show_full').on('mouseenter', function () {
/** mouseenter */
var $this = $(this);
var thisOffset = $this.offset();
Function traverseForPaths
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function traverseForPaths () {
var params = {
pos: $('#pma_navigation_tree').find('div.dbselector select').val()
};
if ($('#navi_db_select').length) {
Function reload
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function reload (callback = null, paths = null): void {
var params: { server: any; reload: boolean; no_debug: boolean, db?: string } = {
'reload': true,
'no_debug': true,
'server': CommonParams.get('server'),
Function filterStateRestore
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function filterStateRestore (): void {
if (isStorageSupported('sessionStorage')
&& typeof window.sessionStorage.navTreeSearchFilters !== 'undefined'
) {
var searchClauses = JSON.parse(window.sessionStorage.navTreeSearchFilters);
- 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 request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
FastFilter.Filter.prototype.request = function (): void {
var self = this;
if (self.$this.find('li.fast_filter').find('img.throbber').length === 0) {
self.$this.find('li.fast_filter').append(
$('<div class="throbber"></div>').append(
- 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 treePagination
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function treePagination ($this): void {
var $msgbox = ajaxShowMessage();
var isDbSelector = $this.closest('div.pageselector').is('.dbselector');
var url = 'index.php?route=/navigation';
var params = 'ajax_request=true';
- 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 loadChildNodes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function loadChildNodes (isNode, $expandElem, callback): void {
var $destination = null;
var params = null;
if (isNode) {
- 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 expandTreeNode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function expandTreeNode ($expandElem, callback = undefined): void {
var $children = $expandElem.closest('li').children('div.list_container');
var $icon = $expandElem.find('img');
if ($expandElem.hasClass('loaded')) {
if ($icon.is('.ic_b_plus')) {
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
var $throbber = $('#pma_navigation').find('.throbber')
.first()
.clone()
.css({ visibility: 'visible', display: 'block' })
.on('click', false);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 61.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
$parent.find('span.pos3_value').first().text(
$parent.find('span.pos3_value').last().text()
);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 48.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
$parent.find('span.pos2_value').first().text(
$parent.find('span.pos2_value').last().text()
);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 48.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($icon.is('.ic_b_minus')) {
$icon.removeClass('ic_b_minus').addClass('ic_b_plus');
$children.slideUp('fast');
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($icon.is('.ic_b_plus')) {
$icon.removeClass('ic_b_plus').addClass('ic_b_minus');
$children.slideDown('fast');
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 45.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76