Showing 17 of 199 total issues
Function process
has a Cognitive Complexity of 149 (exceeds 5 allowed). Consider refactoring. Open
public function process($type = 'spam', $limit = false)
{
//print_r($this->MC);
if ($this->MC->Nmsgs > 0) {
$abused = 0;
- 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 abuse_admin
has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring. Open
function abuse_admin()
{
function_requirements('get_server_from_ip');
function_requirements('class.ImapAbuseCheck');
add_js('bootstrap');
- 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 abuse_admin
has 351 lines of code (exceeds 25 allowed). Consider refactoring. Open
function abuse_admin()
{
function_requirements('get_server_from_ip');
function_requirements('class.ImapAbuseCheck');
add_js('bootstrap');
Method process
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process($type = 'spam', $limit = false)
{
//print_r($this->MC);
if ($this->MC->Nmsgs > 0) {
$abused = 0;
Function abuse
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
function abuse()
{
/*
CREATE TABLE my.abuse (
abuse_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
- 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 ImapAbuseCheck.php
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* TF Related Functionality
* @author Joe Huss <detain@interserver.net>
* @copyright 2019
File abuse_admin.php
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Administrative Functionality
* @author Joe Huss <detain@interserver.net>
* @copyright 2019
Method abuse
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
function abuse()
{
/*
CREATE TABLE my.abuse (
abuse_id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
Function getpart
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function getpart($mid, $p, $partno)
{
// $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
// DECODE DATA
$data = $partno ? imap_fetchbody($this->mbox, $mid, $partno) : // multipart
- 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 getpart
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getpart($mid, $p, $partno)
{
// $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
// DECODE DATA
$data = $partno ? imap_fetchbody($this->mbox, $mid, $partno) : // multipart
Function fix_headers
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function fix_headers($headers)
{
$out = '';
$state = 0;
$headers = 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 __construct
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($imap_server, $username, $password, $db, $delete_attachments = 1, $limit_ips = false)
{
$this->imap_server = $imap_server;
$this->imap_folder = preg_replace('/^{.*}/m', '', $this->imap_server);
$this->imap_username = $username;
Consider simplifying this complex logical expression. Open
if (($logged_in && $GLOBALS['tf']->accounts->data['account_lid'] == $server_data['email']) || ($logged_in && $GLOBALS['tf']->accounts->data['account_lid'] == $db->Record['abuse_lid']) || ($logged_in == false) || ($GLOBALS['tf']->ima == 'admin')) {
if (isset($GLOBALS['tf']->variables->request['response'])) {
$db->query("update abuse set abuse_status='" . $db->real_escape($GLOBALS['tf']->variables->request['response_status']) . "' where abuse_id={$id}", __LINE__, __FILE__);
$db->query("update abuse_data set abuse_response='" . $db->real_escape($GLOBALS['tf']->variables->request['response']) . "' where abuse_id={$id}", __LINE__, __FILE__);
$db->query("select * from abuse left join abuse_data using (abuse_id) where abuse_id={$id}");
Avoid deeply nested control flow statements. Open
if ($db->num_rows() > 0) {
$db->next_record(MYSQL_ASSOC);
$data = $GLOBALS['tf']->accounts->read($db->Record['mail_custid']);
$email = (!isset($data['email_abuse']) || trim($data['email_abuse']) == '') ? $data['account_lid'] : $data['email_abuse'];
$server_data = [
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($imap_server, $username, $password, $db, $delete_attachments = 1, $limit_ips = false)
Avoid deeply nested control flow statements. Open
if ($date < $limit_date) {
continue;
}
Function __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($imap_server, $username, $password, $db, $delete_attachments = 1, $limit_ips = false)
{
$this->imap_server = $imap_server;
$this->imap_folder = preg_replace('/^{.*}/m', '', $this->imap_server);
$this->imap_username = $username;
- 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"