Avoid deeply nested control flow statements. Open
if (file_exists($lookup_file)) {
include_once $lookup_file;
if (!empty($not_config['lookup_func']) && function_exists($not_config['lookup_func'])) {
$lookup_func = $not_config['lookup_func'];
}
TODO found Open
// TODO: it would also be useful to provide links to other available
- Exclude checks
TODO found Open
// TODO: note, we could auto-generate the url from the id
- Exclude checks
FIXME found Open
// FIXME: does this always go back to correct location??
- Exclude checks
TODO found Open
// TODO: need to span over multiple pages...???
- Exclude checks
TODO found Open
// TODO: option to specify one-time??? or other modes??
- Exclude checks
TODO found Open
// TODO: another display mode... instead of one notification per line,
- Exclude checks
FIXME found Open
// FIXME: There is a problem here... in icms_core_Message::confirm it treats arrays as
- Exclude checks
Reference to undeclared constant \_NOT_CATEGORY
Open
$xoopsTpl->assign('lang_category', _NOT_CATEGORY);
- Exclude checks
Reference to undeclared constant \_NOT_ITEMID
Open
$xoopsTpl->assign('lang_itemid', _NOT_ITEMID);
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_itemname', _NOT_ITEMNAME);
- Exclude checks
Reference to undeclared constant \_CANCEL
Open
$xoopsTpl->assign('lang_cancel', _CANCEL);
- Exclude checks
Reference to undeclared constant \_NOT_RUSUREDEL
Open
icms_core_Message::confirm($hidden_vars, '', _NOT_RUSUREDEL);
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$notification_handler = icms::handler('icms_data_notification');
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
redirect_header('notifications.php', 2, implode('<br />', icms::$security->getErrors()));
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_checkall', _NOT_CHECKALL);
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$notification_handler = icms::handler('icms_data_notification');
- Exclude checks
Reference to static property user
from undeclared class \icms
Open
if (empty(icms::$user)) {
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_events', _NOT_EVENTS);
- Exclude checks
Reference to undeclared constant \_NOT_ACTIVENOTIFICATIONS
Open
$xoopsTpl->assign('lang_activenotifications', _NOT_ACTIVENOTIFICATIONS);
- Exclude checks
Reference to undeclared constant \_NOT_NOACCESS
Open
redirect_header('index.php', 3, _NOT_NOACCESS);
- Exclude checks
Call to method setSort
from undeclared class \icms_db_criteria_Item
Open
$criteria->setSort('not_modid,not_category,not_itemid');
- Exclude checks
Reference to undeclared constant \_NOT_EVENT
Open
$xoopsTpl->assign('lang_event', _NOT_EVENT);
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_itemid', _NOT_ITEMID);
- Exclude checks
Reference to static property user
from undeclared class \icms
Open
$uid = (int) icms::$user->getVar('uid');
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_module', _NOT_MODULE);
- Exclude checks
Reference to undeclared constant \_NOT_EVENTS
Open
$xoopsTpl->assign('lang_events', _NOT_EVENTS);
- Exclude checks
Call to method confirm
from undeclared class \icms_core_Message
Open
icms_core_Message::confirm($hidden_vars, '', _NOT_RUSUREDEL);
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_cancel', _CANCEL);
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_clear', _NOT_CLEAR);
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_category', _NOT_CATEGORY);
- Exclude checks
Suspicious array access to nullable ?array
Open
$hidden_vars = array('uid'=>$uid, 'delete_ok'=>1, 'del_not'=>$_POST['del_not']);
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('user', $user_info);
- Exclude checks
Reference to undeclared constant \_NOT_DELETESUCCESS
Open
redirect_header('notifications.php', 2, _NOT_DELETESUCCESS);
- Exclude checks
Call to method __construct
from undeclared class \icms_db_criteria_Item
Open
$criteria = new icms_db_criteria_Item('not_uid', $uid);
- Exclude checks
Reference to undeclared constant \_NOT_NAMENOTAVAILABLE
Open
$item_info = array('name'=>'[' . _NOT_NAMENOTAVAILABLE . ']', 'url'=>'');
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
$xoopsTpl->assign('notification_token', icms::$security->createToken());
- Exclude checks
Call to method handler
from undeclared class \icms
Open
$module_handler = icms::handler('icms_module');
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_delete', _DELETE);
- Exclude checks
Reference to undeclared constant \_NOT_MODULE
Open
$xoopsTpl->assign('lang_module', _NOT_MODULE);
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('notification_token', icms::$security->createToken());
- Exclude checks
Reference to undeclared constant \_NOT_NOTHINGTODELETE
Open
redirect_header('notifications.php', 2, _NOT_NOTHINGTODELETE);
- Exclude checks
Reference to undeclared constant \_NOT_NOTHINGTODELETE
Open
redirect_header('notifications.php', 2, _NOT_NOTHINGTODELETE);
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('modules', $modules);
- Exclude checks
Reference to undeclared constant \_DELETE
Open
$xoopsTpl->assign('lang_delete', _DELETE);
- Exclude checks
Reference to undeclared constant \_NOT_CHECKALL
Open
$xoopsTpl->assign('lang_checkall', _NOT_CHECKALL);
- Exclude checks
Reference to undeclared constant \_NOT_ITEMNAME
Open
$xoopsTpl->assign('lang_itemname', _NOT_ITEMNAME);
- Exclude checks
Reference to static property security
from undeclared class \icms
Open
if (!icms::$security->check()) {
- Exclude checks
Reference to static property user
from undeclared class \icms
Open
$user_info = array('uid' => icms::$user->getVar('uid'));
- Exclude checks
Reference to undeclared constant \_NOT_CLEAR
Open
$xoopsTpl->assign('lang_clear', _NOT_CLEAR);
- Exclude checks
Suspicious array access to nullable ?array
Open
foreach ($_POST['del_not'] as $n_array) {
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_event', _NOT_EVENT);
- Exclude checks
Variable $xoopsTpl
is undeclared Open
$xoopsTpl->assign('lang_activenotifications', _NOT_ACTIVENOTIFICATIONS);
- Exclude checks
Reference to undeclared constant \_NOT_DELETINGNOTIFICATIONS
Open
print '<h4>' . _NOT_DELETINGNOTIFICATIONS . '</h4>';
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!empty($not_config['lookup_file'])) {
$lookup_file = ICMS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/' . $not_config['lookup_file'];
if (file_exists($lookup_file)) {
include_once $lookup_file;
if (!empty($not_config['lookup_func']) && function_exists($not_config['lookup_func'])) {
- 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 105.
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
TRUE, FALSE and NULL must be lowercase; expected "null" but found "NULL" Open
$valid_op = array('cancel', 'list', 'delete', 'delete_ok', '', NULL);
- Exclude checks
Expected 1 blank line at end of file; 2 found Open
}
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks
Unexpected trailing spaces found. Open
- Exclude checks