Showing 310 of 310 total issues
Method b_news_archives_show
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_news_archives_show($options)
{
global $xoopsDB, $xoopsConfig;
// require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
require_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/calendar.php';
Method b_news_topics_moderate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_news_topics_moderate()
{
// require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
/** @var Helper $helper */
Method updateBlock
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups): void
{
$myblock = new \XoopsBlock($bid);
$myblock->setVar('title', $btitle);
$myblock->setVar('weight', $bweight);
Function delTopic
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function delTopic(): void
{
global $xoopsDB, $xoopsModule;
if (!isset($_POST['ok'])) {
xoops_cp_header();
- 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 loadTableFromArrayWithReplace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function loadTableFromArrayWithReplace($table, $data, $search, $replace)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
- 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 store
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function store($approved = false)
{
//$newpost = 0;
$myts = MyTextSanitizer::getInstance();
$title = $myts->censorString($this->title);
- 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 b_news_bigstory_show
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_news_bigstory_show()
{
// require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
/** @var Helper $helper */
Method news_html2text
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function news_html2text($document)
{
// PHP Manual:: function preg_replace
// $document should contain an HTML document.
// This will remove HTML tags, javascript sections
Method html2text
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function html2text($document)
{
// PHP Manual:: function preg_replace
// $document should contain an HTML document.
// This will remove HTML tags, javascript sections
Method b_news_randomnews_edit
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_news_randomnews_edit($options)
{
global $xoopsDB;
$form = _MB_NEWS_ORDER . " <select name='options[]'>";
$form .= "<option value='published'";
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (0 == $options[5]) { // Use a specific news
if ($visible) {
$spotlightArticle = new NewsStory($options[6]);
} else {
$block['use_spotlight'] = 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 111.
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 (0 == $options[5]) { // Use a specific news
$tmpstory = $permstory ?? new NewsStory($options[6]);
} else { // Use the most recent news
$stories = [];
$stories = NewsStory::getAllPublished(1, 0, $restricted, 0, 1, true, $options[0]);
- 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 111.
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
Method getBigStory
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getBigStory(
$limit = 0,
$start = 0,
$checkRight = false,
$topic = 0,
Method makeMySelBox
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = ''): void
{
if ('' == $sel_name) {
$sel_name = $this->id;
}
Method makeMySelBox
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function makeMySelBox(
$title,
$order,
$preset_id,
$none,
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($display) {
$ret[$i]['image'] = 'assets/images/news.png';
$ret[$i]['link'] = 'article.php?storyid=' . $myrow['storyid'] . $searchparam;
$ret[$i]['title'] = $myrow['title'];
$ret[$i]['time'] = $myrow['created'];
- 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 109.
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 ($display) {
$ret[$i]['image'] = 'assets/images/news.png';
$ret[$i]['link'] = 'article.php?storyid=' . $myrow['com_itemid'] . $searchparam;
$ret[$i]['title'] = $myrow['com_title'];
$ret[$i]['time'] = $myrow['com_created'];
- 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 109.
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 makeMySelBox
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = ''): void
{
if ('' == $sel_name) {
$sel_name = $this->id;
}
- 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 news_getWysiwygForm
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function news_getWysiwygForm($caption, $name, $value = '', $width = '100%', $height = '400px', $supplemental = '')
{
$editor_option = \mb_strtolower(news_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 news_getmoduleoption
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function news_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"