Showing 181 of 181 total issues
Method b_gwiki_related_show
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_gwiki_related_show($options)
{
global $xoTheme, $xoopsDB;
$block = false;
Function showPages
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function showPages($message = null)
{
global $xoopsDB;
echo <<<EOT
<style>
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (isset($_POST['xoops_upload_file'][0])) {
$filekey = $_POST['xoops_upload_file'][0];
if (Request::hasVar('error', 'FILES[$filekey]) && !$_FILES[$filekey]')) {
$zapus = [' ', '/', '\\'];
$filename = tempnam($pathname, 'IMPORTHTML_');
- 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 135.
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 (isset($_POST['xoops_upload_file'][0])) {
$filekey = $_POST['xoops_upload_file'][0];
if (Request::hasVar('error', 'FILES[$filekey]) && !$_FILES[$filekey]')) {
$zapus = [' ', '/', '\\'];
$filename = tempnam($pathname, 'IMPORTTEXT_');
- 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 135.
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 truncateHtml
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true)
{
if ($considerHtml) {
// if the plain text is shorter than the maximum length, return the whole text
if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
Method fbcom_plugin
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fbcom_plugin(&$metas, $plugin_env)
{
global $xoopsDB;
$helper = Helper::getInstance();
Function b_gwiki_related_show
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function b_gwiki_related_show($options)
{
global $xoTheme, $xoopsDB;
$block = 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 deleteDirectory
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function deleteDirectory($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
Method b_gwiki_linkshere_show
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_gwiki_linkshere_show($options)
{
global $xoTheme, $xoopsDB;
$block = false;
Method renderLists
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function renderLists($matches)
{
$lines = \explode("\n", $matches[0]);
$last = '';
foreach ($lines as $i => $line) {
Function chooseWizard
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function chooseWizard()
{
global $wikiPage, $xoopsTpl;
$helper = 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
Function wikiLink
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function wikiLink($keyword, $altkey = null)
{
global $xoopsDB;
// HACK - get rid of spaces in page
- 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 checkEdit
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function checkEdit()
{
global $xoopsUser, $xoopsDB;
$mayEdit = false;
Method getPage
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPage($keyword, $id = null)
{
global $xoopsDB;
$this->resetPage();
Method b_gwiki_recentblock_show
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_gwiki_recentblock_show($options)
{
global $xoopsDB, $xoTheme;
$block = false;
Method b_gwiki_teaserblock_show
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_gwiki_teaserblock_show($options)
{
global $xoopsDB, $xoopsConfig, $xoTheme;
$block = false;
Method wikiLink
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function wikiLink($keyword, $altkey = null)
{
global $xoopsDB;
// HACK - get rid of spaces in page
Method updatePrefix
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updatePrefix($pid)
{
global $xoopsDB, $wikiPage;
$row = getPrefix($pid);
Identical blocks of code found in 2 locations. Consider refactoring. Open
function getUserName($uid)
{
global $xoopsConfig;
$uid = (int)$uid;
- 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 120.
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
function getUserName($uid)
{
global $xoopsConfig;
$uid = (int)$uid;
- 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 120.
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