Showing 63 of 63 total issues
Function hoverIntent
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.hoverIntent = function (handlerIn, handlerOut, selector) {
// default configuration values
var cfg = {
interval: 100,
Function mymenus_block_edit
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function mymenus_block_edit($options)
{
/** @var \XoopsModules\Mymenus\Helper $helper */
$helper = \XoopsModules\Mymenus\Helper::getInstance();
//
- 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 getModuleMenus
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function getModuleMenus($module, $pid)
{
global $xoopsModule;
static $id = -1;
/** @var \XoopsModules\Mymenus\Helper $helper */
Function editLink
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function editLink($id = null, $pid = null, $mid = null)
{
/** @var \XoopsModules\Mymenus\Helper $helper */
$helper = \XoopsModules\Mymenus\Helper::getInstance();
//
- 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 getConfig
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getConfig()
{
$moduleDirName = basename(dirname(__DIR__));
$moduleDirNameUpper = strtoupper($moduleDirName);
return (object)[
Method getSkinInfo
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getSkinInfo($moduleSkin = 'default', $useThemeSkin = false, $themeSkin = '')
{
// require __DIR__ . '/common.php';
/** @var \XoopsModules\Mymenus\Helper $helper */
$helper = \XoopsModules\Mymenus\Helper::getInstance();
Function toArray
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
toArray: function (options) {
var o = $.extend({}, this.options, options),
sDepth = o.startDepthCount || 0,
ret = [],
Function supersubs
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.supersubs = function (options) {
var opts = $.extend({}, $.fn.supersubs.defaults, options);
// return original object to support chaining
return this.each(function () {
// cache selections
Method addLink
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addLink($mid)
{
/** @var \XoopsModules\Mymenus\Helper $helper */
$helper = \XoopsModules\Mymenus\Helper::getInstance();
//
Method createUpdateTable
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function createUpdateTable($table, $tablename, \XoopsObject $module)
{
if (!InfoTableExists($GLOBALS['xoopsDB']->prefix($module->getInfo('dirname')) . $tablename)) {
$sql = 'CREATE TABLE ' . $GLOBALS['xoopsDB']->prefix($module->getInfo('dirname')) . $tablename . ' (';
foreach ($table as $s => $w) {
Method checkInfoTable
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function checkInfoTable(\XoopsObject $module)
{
// global $xoopsDB;
$err = true;
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (submenu.getAttribute("rel") == "closed") {
submenu.style.display = "block";
submenu.setAttribute("rel", "open");
ulelement.parentNode.style.backgroundImage = "url(" + ddtreemenu.openfolder + ")"
}
- 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 62.
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
else if (submenu.getAttribute("rel") == "open") {
submenu.style.display = "none";
submenu.setAttribute("rel", "closed");
ulelement.parentNode.style.backgroundImage = "url(" + ddtreemenu.closefolder + ")"
}
- 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 62.
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
Consider simplifying this complex logical expression. Open
if (!o.isAllowed(this.currentItem, parentItem) ||
parentItem && parentItem.hasClass(o.disableNesting) ||
o.protectRoot && (parentItem === null && !isRoot || isRoot && level > 1)) {
this.placeholder.addClass(o.errorClass);
if (maxLevels < levels && maxLevels != 0) {
Method xoops_module_install_mymenus
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoops_module_install_mymenus(\XoopsModule $module)
{
require dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
require dirname(__DIR__) . '/include/config.php';
Method getForm
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getForm($action = false)
{
// $grouppermHandler = xoops_getHandler('groupperm');
//
xoops_load('XoopsFormLoader');
Function getModuleMenus
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected static function getModuleMenus($module, $pid)
{
global $xoopsModule;
static $id = -1;
/** @var \XoopsModules\Mymenus\Helper $helper */
- 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 rrmdir
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function rrmdir($src)
{
// Only continue if user is a 'global' Admin
if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
return false;
- 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 buildSubTree
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
ddtreemenu.buildSubTree = function (treeid, ulelement, index) {
ulelement.parentNode.className = "submenu";
if (typeof persisteduls[treeid] == "object") { //if cookie exists (persisteduls[treeid] is an array versus "" string)
if (ddtreemenu.searcharray(persisteduls[treeid], index)) {
ulelement.setAttribute("rel", "open");
Method buildMenus
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildMenus($pid = 0)
{
static $idx = -1;
static $level = -1;
++$level;