Showing 310 of 310 total issues
Function b_news_topics_moderate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function b_news_topics_moderate()
{
// require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
/** @var 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 launchExport
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function launchExport(): void
{
xoops_cp_header();
$adminObject = Admin::getInstance();
$adminObject->displayNavigation('index.php?op=export');
- 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 xoops_module_pre_install_news
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function xoops_module_pre_install_news(\XoopsModule $module)
{
// Check if this XOOPS version is supported
$minSupportedVersion = explode('.', '2.5.0');
$currentVersion = explode('.', mb_substr(XOOPS_VERSION, 6));
- 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 isBlockCloned
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function isBlockCloned(int $bid, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
{
\xoops_loadLanguage('admin', 'system');
\xoops_loadLanguage('admin/blocksadmin', 'system');
\xoops_loadLanguage('admin/groups', 'system');
- 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 getWysiwygForm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
{
$editor_option = \mb_strtolower(static::getModuleOption('form_options'));
$editor = false;
$editor_configs = [];
- 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 getModuleOption
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getModuleOption($option, $repmodule = 'news')
{
global $xoopsModuleConfig, $xoopsModule;
static $tbloptions = [];
if (\is_array($tbloptions) && \array_key_exists($option, $tbloptions)) {
- 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 createNewsletter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createNewsletter(): void
{
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
xoops_cp_header();
$adminObject = Admin::getInstance();
Method cloneBlock
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function cloneBlock(int $bid): void
{
//require_once __DIR__ . '/admin_header.php';
// \xoops_cp_header();
Method orderBlock
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function orderBlock(
array $bid, array $oldtitle, array $oldside, array $oldweight, array $oldvisible, array $oldgroups, array $oldbcachetime, array $oldbmodule, array $title, array $weight, array $visible, array $side, array $bcachetime, array $groups, array $bmodule
): void {
if (!$GLOBALS['xoopsSecurity']->check()) {
\redirect_header($_SERVER['SCRIPT_NAME'], 3, \implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
Method renderImageNav
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderImageNav($offset = 4)
{
if ($this->total < $this->perpage) {
return null;
}
Method editBlock
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function editBlock(int $bid): void
{
// require_once \dirname(__DIR__,2) . '/admin/admin_header.php';
// \xoops_cp_header();
\xoops_loadLanguage('admin', 'system');
Method uname
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function uname($uid = 0)
{
global $xoopsConfig;
static $tblusers = [];
$option = -1;
Consider simplifying this complex logical expression. Open
if ($approveprivilege && 'edit' === $_GET['op']) {
$op = 'edit';
$storyid = Request::getInt('storyid', 0, 'GET');
} elseif ($approveprivilege && 'delete' === $_GET['op']) {
$op = 'delete';
Method confirmBeforePrune
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function confirmBeforePrune(): void
{
global $dateformat;
$story = new NewsStory();
xoops_cp_header();
Method news_tag_synchronization
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function news_tag_synchronization($mid): void
{
global $xoopsDB;
$itemHandler_keyName = 'storyid';
$itemHandler_table = $xoopsDB->prefix('news_stories');
Method renderNav
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderNav($offset = 4)
{
$ret = '';
if ($this->total <= $this->perpage) {
return $ret;
Method exportNews
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function exportNews(): void
{
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
xoops_cp_header();
$adminObject = Admin::getInstance();
Method getStoriesByIds
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStoriesByIds(
$ids,
$checkRight = true,
$asobject = true,
$order = 'published',
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function topic_rssurl($format = 'S')
{
$myts = \MyTextSanitizer::getInstance();
switch ($format) {
case 'S':
- 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 106.
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
public function topic_color($format = 'S')
{
$myts = \MyTextSanitizer::getInstance();
switch ($format) {
case 'S':
- 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 106.
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