detain/myadmin-cloudlinux-licensing

View on GitHub

Showing 4 of 7 total issues

Function getChangeIp has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getChangeIp(GenericEvent $event)
    {
        if ($event['category'] == get_service_define('CLOUDLINUX')) {
            $serviceClass = $event->getSubject();
            $settings = get_module_settings(self::$module);
Severity: Minor
Found in src/Plugin.php - About 1 hr to fix

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 cloudlinux_licenses_list has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function cloudlinux_licenses_list()
{
    if ($GLOBALS['tf']->ima == 'admin') {
        require_once __DIR__.'/../../../workerman/statistics/Applications/Statistics/Clients/StatisticClient.php';
        $table = new \TFTable();
Severity: Minor
Found in src/cloudlinux_licenses_list.php - About 1 hr to fix

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 getChangeIp has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getChangeIp(GenericEvent $event)
    {
        if ($event['category'] == get_service_define('CLOUDLINUX')) {
            $serviceClass = $event->getSubject();
            $settings = get_module_settings(self::$module);
Severity: Minor
Found in src/Plugin.php - About 1 hr to fix

    Function getActivate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getActivate(GenericEvent $event)
        {
            $serviceClass = $event->getSubject();
            if ($event['category'] == get_service_define('CLOUDLINUX')) {
                myadmin_log(self::$module, 'info', 'Cloudlinux Activation', __LINE__, __FILE__, self::$module, $serviceClass->getId());
    Severity: Minor
    Found in src/Plugin.php - About 55 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language