Showing 4,217 of 4,217 total issues
Method _generate_sitemap
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _generate_sitemap()
{
main()->NO_GRAPHICS = true;
if ( ! $this->SITE_MAP_ENABLED) {
return false;
Method _validate_rules_cleanup
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _validate_rules_cleanup($validate_rules = [])
{
// Trim names with spaces
foreach ((array) $validate_rules as $name => $raw) {
$trimmed = trim($name);
File class_db_real_migrator_mysql.Test__off__.php
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
require_once __DIR__ . '/db_real_abstract.php';
/**
Function _tree_items
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function _tree_items(&$data, $extra = [])
{
if ($extra['show_controls'] && ! is_callable($extra['show_controls'])) {
$r = [
'edit_link' => isset($extra['edit_link']) ? $extra['edit_link'] : url('/@object/edit_item/%d/@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
Function go
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function go()
{
if ( ! db()->QUERY_LOG) {
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
Function _loop_detected
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function _loop_detected($cur_url)
{
if ( ! $this->LOOP_DEFENCE) {
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 _show_for_object
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _show_for_object($params = [])
{
if ($this->USE_TREE_MODE) {
return $this->_show_for_object_tree($params);
}
Method _process_where
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _process_where(array $where, $func_name = 'where', $return_array = false)
{
$sql = '';
if ($count = count((array) $where)) {
$all_numeric = $this->_is_where_all_numeric($where);
Method _filter_array
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _filter_array(&$data, $filter = [], $filter_params = [], $table = null)
{
if ( ! $data || ! $filter) {
return false;
}
Method read
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function read($filename)
{
// split the file into lines, we'll process it line by line
$config_file = file($filename);
Method _do_debug_db_connection_queries
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _do_debug_db_connection_queries($db, $connect_trace = [])
{
if ( ! $this->SHOW_DB_QUERY_LOG) {
return '';
}
Method read
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function read($filename)
{
// split the file into lines, we'll process it line by line
$config_file = file($filename);
Method _get_modules_from_files
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _get_modules_from_files($include_framework = true, $with_sub_modules = false)
{
$admin_modules_array = [];
$pattern_include = '-f ~/' . preg_quote(ADMIN_MODULES_DIR, '~') . '.*' . preg_quote(YF_CLS_EXT, '~') . '$~';
File sys_log_core_errors.sql_php.php
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
return [
'fields' => [
'id' => [
Method test_whereid
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_whereid()
{
if ($this->_need_skip_test(__FUNCTION__)) {
return;
}
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ( ! empty($_GET['id'])) {
$file_name = urldecode($_GET['id']);
$file_path = $file_name;
$dir_name = dirname($file_path);
} else {
- 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 163.
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
if ( ! empty($_GET['id'])) {
$file_name = urldecode($_GET['id']);
$file_path = $file_name;
$dir_name = dirname($file_path);
} else {
- 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 163.
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
yf_payment_api__provider_webmoney
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class yf_payment_api__provider_webmoney extends yf_payment_api__provider_remote
{
// номер перевода в системе учета отправителя; любое целое число без знака (целое число > 0; максимально 2^31 - 1), должно быть уникальным в пределах WMID, который подписывает запрос.
// Два перевода с одним и тем же tranid с одного WMID (даже с разных кошельков) осуществить невозможно.
// Уникальность значения tranid контролируется в интервале не менее одного года.
Method text
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function text($name, $desc = '', $extra = [])
{
// Shortcut: use second param as $extra
if (is_array($desc)) {
$extra = (array) $extra + $desc;
yf_ssh
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class yf_ssh
{
// TODO: chained mode like in form and table, mass actions on one server, array of servers, named group(s) of servers:
// ssh('s23.dev')->exec('service memcached restart');
// ssh('s23*.dev')->exec('service memcached restart');