Showing 176 of 176 total issues
Function browser_detection
has a Cognitive Complexity of 137 (exceeds 5 allowed). Consider refactoring. Open
function browser_detection( $which_test, $test_excludes='', $external_ua_string='' )
{
/*
uncomment the global variable declaration if you want the variables to be available on
a global level throughout your php page, make sure that php is configured to support
- 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
File feedcreator.class.php
has 848 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/***************************************************************************
FeedCreator class v1.7.2-ppt
originally (c) Kai Blankenhorn
Method browser_detection
has 399 lines of code (exceeds 25 allowed). Consider refactoring. Open
function browser_detection( $which_test, $test_excludes='', $external_ua_string='' )
{
/*
uncomment the global variable declaration if you want the variables to be available on
a global level throughout your php page, make sure that php is configured to support
Function addInstant
has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring. Open
function addInstant() {
var theimages = getImages('instant');
var image; var object; var canvas; var context;
var border = 16; var offset = 8; var inset = 2;
var icolor = ''; var ishadow = 0; var noshading;
- 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 addIEInstant
has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring. Open
function addIEInstant() {
var theimages = getImages('instant');
var image; var object; var vml; var display;
var border = 16; var offset = 8; var scale = 1;
var icolor = ''; var ishadow = 0; var noshading;
- 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
File browser_detection.php
has 700 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
Script Name: Full Featured PHP Browser/OS detection
Author: Harald Hope, Website: http://techpatterns.com/
Script Source URI: http://techpatterns.com/downloads/php_browser_detection.php
Function lightBox
has 309 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.lightBox = function(settings) {
// Settings to configure the jQuery lightBox plugin how you like
settings = jQuery.extend({
// Configuration related to overlay
overlayBgColor: '#000', // (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( settings.activeImage != 0 ) {
if ( settings.fixedNavigation ) {
$('#lightbox-nav-btnPrev').css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' })
.unbind()
.bind('click',function() {
- 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 251.
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 ( settings.activeImage != ( settings.imageArray.length -1 ) ) {
if ( settings.fixedNavigation ) {
$('#lightbox-nav-btnNext').css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' })
.unbind()
.bind('click',function() {
- 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 251.
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 _httprequest
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="")
{
if($this->passcookies && $this->_redirectaddr)
$this->setcookies();
- 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
File Snoopy.class.php
has 588 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*************************************************
Snoopy - the PHP net client
Function get_os_data
has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring. Open
function get_os_data ( $pv_browser_string, $pv_browser_name, $pv_version_number )
{
// initialize variables
$os_working_type = '';
$os_working_number = '';
- 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 _httpsrequest
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
function _httpsrequest($url,$URI,$http_method,$content_type="",$body="")
{
if($this->passcookies && $this->_redirectaddr)
$this->setcookies();
- 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 fetch
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
function fetch($URI)
{
//preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS);
$URI_PARTS = parse_url($URI);
- 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
DependencyManager
has 54 functions (exceeds 20 allowed). Consider refactoring. Open
class DependencyManager
{
const SITE_THEME_KEY = 'siteTheme';
const SITE_THEME_ENHANCED_KEY = 'siteThemeEnhanced';
const THIS_PAGE_KEY = 'thisPage';
File DependencyManager.php
has 453 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace travi\framework\dependencyManagement;
use travi\framework\utilities\FileSystem,
Function upload
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
function upload($isImage=false)
{
if ($this->acceptedMimetype($this->mimetype)) {
$this->checkDirectory();
- 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 get_os_data
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_os_data ( $pv_browser_string, $pv_browser_name, $pv_version_number )
{
// initialize variables
$os_working_type = '';
$os_working_number = '';
File upload.class.php
has 401 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
class Uploader
{
var $file_ref;
File instant.js
has 399 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* instant.js 2.4 (10-Aug-2010)
* (c) by Christian Effenberger
* All Rights Reserved
* Source: instant.netzgesta.de