Showing 47,251 of 47,256 total issues
Function icms_getModuleConfig
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function &icms_getModuleConfig($moduleName = false)
{
static $icmsConfigs;
if(isset ($icmsConfigs[$moduleName]))
{
- 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 __construct
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function __construct() {
if (isset( $_SESSION['settings']['ROOT_PATH'] )) {
$this->xoopsRootPath = $_SESSION['settings']['ROOT_PATH'];
} else {
$path = str_replace( "\\", "/", @realpath( '../' ) );
- 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 AllowedMimeTypes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function AllowedMimeTypes() {
$GrantedItems = $this->UserCanUpload();
$array = array();
$grantedItemValues = array_values($GrantedItems);
if (!empty($grantedItemValues)) {
- 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 b_system_login_show
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function b_system_login_show() {
global $icmsConfig, $icmsConfigAuth, $icmsConfigUser;
if (!icms::$user) {
$block = array();
$block['lang_username'] = _USERNAME;
- 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 imanager_updatecat
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function imanager_updatecat() {
/* because we are using a function, the GET/POST variables are not in scope */
global $imgcat_id, $imgcat_name, $imgcat_display, $imgcat_maxsize, $imgcat_maxwidth, $imgcat_maxheight, $imgcat_weight, $readgroup, $writegroup;
if (!icms::$security->check() || $imgcat_id <= 0) {
redirect_header('admin.php?fct=images', 1, implode('<br />', icms::$security->getErrors()));
- 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 imanager_reordercateg
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function imanager_reordercateg() {
if (!icms::$security->check()) {
redirect_header('admin.php?fct=images', 1, implode('<br />', icms::$security->getErrors()));
}
$count = count($_POST['imgcat_weight']);
- 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 xoFormFieldCharset
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoFormFieldCharset($name, $value, $label, $link, $help = '') {
if (version_compare(getDBVersion($link), "4.1.0", "lt")) {
return "";
}
if (!$chars = getDbCharsets($link)) {
Method Generate_PDF
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Generate_PDF ($content, $doc_title, $doc_keywords) {
global $icmsConfig;
require_once ICMS_PDF_LIB_PATH.'/tcpdf.php';
icms_loadLanguageFile('core', 'pdf');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
Method makeWritable
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeWritable( $path, $group = false, $recurse = false) {
if (!file_exists( $path )) {
return false;
}
$perm = @is_dir( $path ) ? 6 : 7;
Method getHtml4Assign
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getHtml4Assign() {
$as_md5 = $this->getMd5();
$as_md5array = preg_split('//', $as_md5, -1, PREG_SPLIT_NO_EMPTY);
$as_md5shuffle = array ();
foreach ($as_md5array as $key => $val) {
Method imanager_delfileok
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function imanager_delfileok($image_id, $redir = NULL) {
if (!icms::$security->check()) {
redirect_header('admin.php?fct=images', 3, implode('<br />', icms::$security->getErrors()));
}
Method imanager_editcat
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function imanager_editcat($imgcat_id) {
if ($imgcat_id <= 0) {
redirect_header('admin.php?fct=images', 1);
}
$imgcat_handler = icms::handler('icms_image_category');
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!$gperm_handler->insert($mperm)) {
$msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_ADMIN_PERM_ADD_FAIL . '</span>', '<strong>' . icms_conv_nr2local($mygroup) . '</strong>');
} else {
$msgs[] = sprintf(' ' . _MD_AM_ADMIN_PERM_ADDED, '<strong>' . icms_conv_nr2local($mygroup) . '</strong>');
}
- 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 102.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (count($system_catids) > 0) {
array_push($admin_mids, 1);
foreach ($system_catids as $s_cid) {
$sysperm =& $gperm_handler->create();
- 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 102.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!$gperm_handler->insert($mperm)) {
$msgs[] = sprintf(' <span style="color:#ff0000;">' . _MD_AM_USER_PERM_ADD_FAIL . '</span>', '<strong>' . icms_conv_nr2local($mygroup) . '</strong>');
} else {
$msgs[] = sprintf(' ' . _MD_AM_USER_PERM_ADDED, '<strong>' . icms_conv_nr2local($mygroup) . '</strong>');
}
- 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 102.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (count($system_catids) > 0) {
array_push($admin_mids, 1);
foreach ($system_catids as $s_cid) {
$sysperm =& $gperm_handler->create();
- 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 102.
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
Function getElementsByClassName
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
function iter(name) {
return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
}
Function addMethods
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addMethods(source) {
var ancestor = this.superclass && this.superclass.prototype,
properties = Object.keys(source);
if (IS_DONTENUM_BUGGY) {
Method icms_purifyText
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function icms_purifyText($text, $keyword = false) {
$text = str_replace(' ', ' ', $text);
$text = str_replace('<br />', ' ', $text);
$text = str_replace('<br/>', ' ', $text);
$text = str_replace('<br', ' ', $text);
Method xoops_comment_delete
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoops_comment_delete($module_id, $item_id)
{
if( (int) ($module_id) > 0 && (int) ($item_id) > 0)
{
$comment_handler = icms::handler('icms_data_comment');