stevotvr/phpbb-groupsub

View on GitHub

Showing 31 of 50 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function delete($id)
    {
        if (!$this->auth->acl_get('a_groupsub_subscriptions_edit'))
        {
            return;
Severity: Major
Found in controller/acp_subs_controller.php and 1 other location - About 7 hrs to fix
controller/acp_subs_controller.php on lines 516..552

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 244.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function restart($id)
    {
        if (!$this->auth->acl_get('a_groupsub_subscriptions_edit'))
        {
            return;
Severity: Major
Found in controller/acp_subs_controller.php and 1 other location - About 7 hrs to fix
controller/acp_subs_controller.php on lines 557..593

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 244.

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

Further Reading

The class subscription has an overall complexity of 67 which is very high. The configured complexity threshold is 50.
Open

class subscription extends operator implements subscription_interface
{
    /**
     * @var manager
     */
Severity: Minor
Found in operator/subscription.php by phpmd

The class acp_pkgs_controller has an overall complexity of 71 which is very high. The configured complexity threshold is 50.
Open

class acp_pkgs_controller extends acp_base_controller implements acp_pkgs_interface
{
    /**
     * @var pkg_operator
     */
Severity: Minor
Found in controller/acp_pkgs_controller.php by phpmd

The class acp_subs_controller has an overall complexity of 68 which is very high. The configured complexity threshold is 50.
Open

class acp_subs_controller extends acp_base_controller implements acp_subs_interface
{
    /**
     * @var pkg_operator
     */
Severity: Minor
Found in controller/acp_subs_controller.php by phpmd

Similar blocks of code found in 2 locations. Consider refactoring.
Open

$(document).on('click', '.move_term_up', function() {
    var row = $(this).parents('tr'),
        prev = row.prev();
    row.insertBefore(prev);

Severity: Major
Found in adm/style/edit_package.js and 1 other location - About 1 hr to fix
adm/style/edit_package.js on lines 16..22

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 67.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

$(document).on('click', '.move_term_down', function() {
    var row = $(this).parents('tr'),
        next = row.next();
    row.insertAfter(next);

Severity: Major
Found in adm/style/edit_package.js and 1 other location - About 1 hr to fix
adm/style/edit_package.js on lines 8..14

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 67.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            foreach ($end_actions as $action)
            {
                if ($action['name'] === 'gs_add_group')
                {
                    $groups_end_add[] = (int) $action['param'];
Severity: Minor
Found in controller/acp_pkgs_controller.php and 1 other location - About 40 mins to fix
controller/acp_pkgs_controller.php on lines 299..313

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 94.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            foreach ($start_actions as $action)
            {
                if ($action['name'] === 'gs_add_group')
                {
                    $groups_start_add[] = (int) $action['param'];
Severity: Minor
Found in controller/acp_pkgs_controller.php and 1 other location - About 40 mins to fix
controller/acp_pkgs_controller.php on lines 315..329

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 94.

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

Further Reading

The class main_controller has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
Open

class main_controller
{
    /**
     * @var auth
     */
Severity: Minor
Found in controller/main_controller.php by phpmd

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

The class ppjs_controller has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
Open

class ppjs_controller
{
    /**
     * @var config
     */
Severity: Minor
Found in controller/ppjs_controller.php by phpmd

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function revert_perms()
    {
        $this->db->sql_query("UPDATE " . MODULES_TABLE . " SET module_auth = 'ext_stevotvr/groupsub && acl_a_board' WHERE module_langname = 'ACP_GROUPSUB_SETTINGS'");
        $this->db->sql_query("UPDATE " . MODULES_TABLE . " SET module_auth = 'ext_stevotvr/groupsub && acl_a_board' WHERE module_langname = 'ACP_GROUPSUB_MANAGE_PKGS'");
        $this->db->sql_query("UPDATE " . MODULES_TABLE . " SET module_auth = 'ext_stevotvr/groupsub && acl_a_board' WHERE module_langname = 'ACP_GROUPSUB_MANAGE_SUBS'");
Severity: Minor
Found in migrations/version_1_2_1.php and 1 other location - About 35 mins to fix
migrations/version_1_2_1.php on lines 63..69

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 92.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function update_perms()
    {
        $this->db->sql_query("UPDATE " . MODULES_TABLE . " SET module_auth = 'ext_stevotvr/groupsub && acl_a_groupsub_settings' WHERE module_langname = 'ACP_GROUPSUB_SETTINGS'");
        $this->db->sql_query("UPDATE " . MODULES_TABLE . " SET module_auth = 'ext_stevotvr/groupsub && acl_a_groupsub_packages' WHERE module_langname = 'ACP_GROUPSUB_MANAGE_PKGS'");
        $this->db->sql_query("UPDATE " . MODULES_TABLE . " SET module_auth = 'ext_stevotvr/groupsub && acl_a_groupsub_subscriptions' WHERE module_langname = 'ACP_GROUPSUB_MANAGE_SUBS'");
Severity: Minor
Found in migrations/version_1_2_1.php and 1 other location - About 35 mins to fix
migrations/version_1_2_1.php on lines 74..80

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 92.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        return fetch(paypal_button_config.u_create, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded',
            },
Severity: Minor
Found in styles/all/theme/paypal_buttons.js and 1 other location - About 30 mins to fix
styles/all/theme/paypal_buttons.js on lines 22..35

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 45.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        return fetch(paypal_button_config.u_capture, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded',
            },
Severity: Minor
Found in styles/all/theme/paypal_buttons.js and 1 other location - About 30 mins to fix
styles/all/theme/paypal_buttons.js on lines 11..19

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 45.

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

Further Reading

The method __construct has 12 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function __construct(auth $auth, config $config, db_text $config_text, currency_interface $currency, helper $helper, language $language, package_interface $pkg_operator, request_interface $request, subscription_interface $sub_operator, template $template, unit_helper_interface $unit_helper, user $user)
    {
        $this->auth = $auth;
        $this->config = $config;
        $this->config_text = $config_text;
Severity: Minor
Found in controller/main_controller.php by phpmd

The method parse_actions() has an NPath complexity of 512. The configured NPath complexity threshold is 200.
Open

    protected function parse_actions($package_id)
    {
        if (!$package_id)
        {
            return;
Severity: Minor
Found in controller/acp_pkgs_controller.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method add_edit_sub_data() has an NPath complexity of 10806. The configured NPath complexity threshold is 200.
Open

    protected function add_edit_sub_data(sub_entity $entity, $params)
    {
        $this->add_lang();

        $errors = array();
Severity: Minor
Found in controller/acp_subs_controller.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method add_edit_sub_data() has 109 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    protected function add_edit_sub_data(sub_entity $entity, $params)
    {
        $this->add_lang();

        $errors = array();
Severity: Minor
Found in controller/acp_subs_controller.php by phpmd

The method execute_actions() has an NPath complexity of 10500. The configured NPath complexity threshold is 200.
Open

    protected function execute_actions($user_id, $pkg_id, $end = false)
    {
        $actions = $end ? $this->pkg_operator->get_end_actions($pkg_id) : $this->pkg_operator->get_start_actions($pkg_id);

        $groups_add = array();
Severity: Minor
Found in operator/subscription.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Severity
Category
Status
Source
Language