Showing 9,653 of 9,653 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
toggleFullscreen: function( callback ) {
this._fullscreen[ this.isFullscreen() ? 'exit' : 'enter'].apply( this, Utils.array( arguments ) );
return this;
},
- 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 57.
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 checkWpFooter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function checkWpFooter()
{
$current_theme = wp_get_theme();
$theme_name = $current_theme->Template;
- 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 convertorderbytrans
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function convertorderbytrans($SortbyOrderby)
{
$orderbyTrans = [];
if ('photo_date DESC' === $SortbyOrderby) {
$orderbyTrans = _MD_EXTGALLERY_ORDERBY_DATEASC;
- 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 ajax_create_slide
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function ajax_create_slide()
{
// security check
if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'metaslider_addslide')) {
echo "<tr><td colspan='2'>" . __('Security check failed. Refresh page and try again.', 'metaslider') . '</td></tr>';
- 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 convertorderbytrans
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function convertorderbytrans($SortbyOrderby)
{
$orderbyTrans = [];
if ('photo_date DESC' === $SortbyOrderby) {
$orderbyTrans = _MD_EXTGALLERY_ORDERBY_DATEASC;
- 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 tmpdir
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function tmpdir()
{
if (OS_WINDOWS) {
if ($var = $_ENV['TMP'] ?? getenv('TMP')) {
return $var;
- 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 getSum
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getSum(\CriteriaElement $criteria = null, $sum = '*')
{
$field = '';
$groupby = false;
if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) {
- 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 _makeWatermark
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _makeWatermark($imageTransform)
{
if (!\function_exists('imagettfbbox')) {
return;
}
- 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 getMax
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getMax(\CriteriaElement $criteria = null, $max = '*')
{
$field = '';
$groupby = false;
if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) {
- 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 PclTraceAction
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function PclTraceAction($p_entry)
{
global $g_pcl_trace_level;
global $g_pcl_trace_mode;
global $g_pcl_trace_filename;
- 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 lazyLoadChunks
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
lazyLoadChunks: function( size, delay ) {
var len = this.getDataLength(),
i = 0,
n = 0,
Function lazyLoadChunks
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
lazyLoadChunks: function( size, delay ) {
var len = this.getDataLength(),
i = 0,
n = 0,
Function remove
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
remove: function(element, label, fn) {
var timers = jQuery.data(element, this.dataKey), ret;
if ( timers ) {
Function animate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function animate( $element, properties, direct, callback, easing )
{
var duration = _duration;
if ( $.isNumeric( direct ) )
Function _openClick
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_openClick: function(e, el, options) {
var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick;
if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey ) ) {
Function parseEl
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseEl: function(index) {
var item = mfp.items[index],
type;
if(item.tagName) {
Function cbResize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
publicMethod.cbResize = function (options) {
var scrolltop;
if (open) {
options = options || {};
Method extgalleryTopSubmitterShow
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function extgalleryTopSubmitterShow($options)
{
global $xoopsDB, $xoopsConfig;
$catauth = '';
$block = [];
Method loadSampleData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadSampleData()
{
global $xoopsConfig;
$moduleDirName = \basename(\dirname(__DIR__));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
Method getList
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getList(CriteriaElement $criteria = null, $limit = 0, $start = 0)
{
$ret = [];
if (null === $criteria) {
$criteria = new CriteriaCompo();