Showing 5,122 of 5,122 total issues
Method expireAd
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function expireAd(): void
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta;
$helper = Helper::getInstance();
Function processRow
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
processRow: function( c, data, vars ) {
var result, filterMatched,
fxn, ffxn, txt,
wo = c.widgetOptions,
showRow = true,
Function processRow
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
processRow: function( c, data, vars ) {
var result, filterMatched,
fxn, ffxn, txt,
wo = c.widgetOptions,
showRow = true,
Method index
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
function index(): void
{
global $xoopsDB, $myts, $admin_lang;
// require_once __DIR__ . '/admin_header.php';
xoops_cp_header();
Similar blocks of code found in 2 locations. Consider refactoring. Open
case 'copyfile':
if (Request::hasVar('original_file_path', 'POST')) {
$original_file_path = $_POST['original_file_path'];
}
if (Request::hasVar('file_path', 'POST')) {
- 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 168.
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
case 'setdirperm':
if (Request::hasVar('path', 'POST')) {
$path = $_POST['path'];
}
if (Request::hasVar('redirect', 'POST')) {
- 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 168.
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 modifyAds
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function modifyAds($lid): void
{
global $xoopsDB, $myts, $desctext, $admin_lang;
$helper = Helper::getInstance();
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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 modifyAd
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function modifyAd($lid): void
{
global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $desctext;
$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 setup
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
setup : function( table, c ) {
// if no thead or tbody, or tablesorter is already present, quit
if ( !table || !table.tHead || table.tBodies.length === 0 || table.hasInitialized === true ) {
if ( ts.debug(c, 'core') ) {
if ( table.hasInitialized ) {
Function setup
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
setup : function( table, c ) {
// if no thead or tbody, or tablesorter is already present, quit
if ( !table || !table.tHead || table.tBodies.length === 0 || table.hasInitialized === true ) {
if ( ts.debug(c, 'core') ) {
if ( table.hasInitialized ) {
Function then
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
then: function( onFulfilled, onRejected, onProgress ) {
var maxDepth = 0;
function resolve( depth, deferred, handler, special ) {
return function() {
var that = this,
Function format
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
format: function(table, c, wo) {
var i, tmp, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
themesAll = ts.themes,
$table = c.$table.add( $( c.namespace + '_extra_table' ) ),
$headers = c.$headers.add( $( c.namespace + '_extra_headers' ) ),
Function format
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
format: function(table, c, wo) {
var i, tmp, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
themesAll = ts.themes,
$table = c.$table.add( $( c.namespace + '_extra_table' ) ),
$headers = c.$headers.add( $( c.namespace + '_extra_headers' ) ),
Function Animation
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = Animation.prefilters.length,
Method adsModCat
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
function adsModCat($cid): void
{
global $xoopsDB, $myts;
$helper = Helper::getInstance();
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
Method render
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render(?array $block = null): void
{
\xoops_load('XoopsFormLoader');
\xoops_loadLanguage('common', $this->moduleDirNameUpper);
Method __construct
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($target)
{
$this->helper = $target->helper;
$this->targetObject = $target;
Function trigger
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
trigger: function( event, data, elem, onlyHandlers ) {
var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
eventPath = [ elem || document ],
type = hasOwn.call( event, "type" ) ? event.type : event,
Method adslight_b2_show
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
function adslight_b2_show($options)
{
if (!class_exists(Helper::class)) {
return [];
}
Function indexView
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function indexView($lid = null): void
{
global $xoopsDB, $myts, $desctext, $admin_lang;
$helper = Helper::getInstance();
$mytree = new Tree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
- 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"