mercadopago/cart-wp-commerce

View on GitHub

Showing 73 of 163 total issues

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

    if ( $form_labels == '' ) {
        $form_labels = array(
            "form" => array(
                "payment_approved" => __( "Payment <strong>approved</strong>.", "wpecomm-mercadopago-module" ),
                "payment_in_process" => __( "Your payment under <strong>review</strong>.", "wpecomm-mercadopago-module" ),
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-custom.php and 1 other location - About 4 days to fix
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 68..133

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

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

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

        if ( $form_labels == '' ) {
            $form_labels = array(
                "form" => array(
                    "payment_approved" => __( "Payment <strong>approved</strong>.", "wpecomm-mercadopago-module" ),
                    "payment_in_process" => __( "Your payment under <strong>review</strong>.", "wpecomm-mercadopago-module" ),
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-custom.php and 1 other location - About 4 days to fix
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1137..1202

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

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

    private static function build_request($request) {
        if (!extension_loaded ("curl")) {
            throw new MercadoPagoException("cURL extension not found. You need to enable cURL in your php.ini or another configuration you have.");
        }

Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-lib/mercadopago.php and 1 other location - About 4 days to fix
wpecomm-mercado-pago-module/mercadopago-lib/mercadopago.php on lines 516..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 744.

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

    private static function build_request_ml($request) {
        if (!extension_loaded ("curl")) {
            throw new MercadoPagoException("cURL extension not found. You need to enable cURL in your php.ini or another configuration you have.");
        }

Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-lib/mercadopago.php and 1 other location - About 4 days to fix
wpecomm-mercado-pago-module/mercadopago-lib/mercadopago.php on lines 595..672

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

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 3 locations. Consider refactoring.
Open

    if ($result['is_valid'] == true) {
        try {
            // checking the currency
            if (!isSupportedCurrency_custom($result['site_id'])) {
                if (get_option('mercadopago_custom_currencyconversion') == 'inactive') {
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-custom.php and 2 other locations - About 3 days to fix
wpecomm-mercado-pago-module/mercadopago-basic.php on lines 269..311
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 650..693

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

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 3 locations. Consider refactoring.
Open

    if ($result['is_valid'] == true) {
        try {
            // checking the currency
            if (!isSupportedCurrency_ticket($result['site_id'])) {
                if (get_option('mercadopago_ticket_currencyconversion') == 'inactive') {
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-ticket.php and 2 other locations - About 3 days to fix
wpecomm-mercado-pago-module/mercadopago-basic.php on lines 269..311
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 788..831

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

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 3 locations. Consider refactoring.
Open

    if ($result['is_valid'] == true) {
        try {
            // checking the currency
            if (!isSupportedCurrency($result['site_id'])) {
                if (get_option('mercadopago_certified_currencyconversion') == 'inactive') {
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-basic.php and 2 other locations - About 3 days to fix
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 788..831
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 650..693

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

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

        if (sizeof($wpsc_cart->cart_items) > 0) {
            foreach ($wpsc_cart->cart_items as $i => $item) {
                if ($item->quantity > 0) {
                    $product = get_post($item->product_id);
                    $picture_url = 'https://www.mercadopago.com/org-img/MP3/home/logomp3.gif';
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-ticket.php and 1 other location - About 3 days to fix
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 276..354

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

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

        if (sizeof($wpsc_cart->cart_items) > 0) {
            foreach ($wpsc_cart->cart_items as $i => $item) {
                if ($item->quantity > 0) {
                    $product = get_post($item->product_id);
                    $picture_url = 'https://www.mercadopago.com/org-img/MP3/home/logomp3.gif';
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-custom.php and 1 other location - About 3 days to fix
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 198..276

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

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

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

            $form_labels = array(
                "form" => array(
                    "issuer_selection" => __( 'Please, select the ticket issuer of your preference.', 'wpecomm-mercadopago-module' ),
                    "payment_instructions" => __( 'Click [Place order] button. The ticket will be generated and you will be redirected to print it.', 'wpecomm-mercadopago-module' ),
                    "ticket_note" => __( 'Important - The order will be confirmed only after the payment approval.', 'wpecomm-mercadopago-module' ),
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-ticket.php and 1 other location - About 1 day to fix
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 615..641

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

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

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

    $form_labels = array(
        "form" => array(
            "issuer_selection" => __( 'Please, select the ticket issuer of your preference.', 'wpecomm-mercadopago-module' ),
            "payment_instructions" => __( 'Click [Place order] button. The ticket will be generated and you will be redirected to print it.', 'wpecomm-mercadopago-module' ),
            "ticket_note" => __( 'Important - The order will be confirmed only after the payment approval.', 'wpecomm-mercadopago-module' ),
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-ticket.php and 1 other location - About 1 day to fix
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 70..96

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

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 5 locations. Consider refactoring.
Open

function currency_conversion_custom() {
    $currencyconversion = get_option('mercadopago_custom_currencyconversion');
    $currencyconversion = $currencyconversion === false || is_null($currencyconversion) ? "inactive" : $currencyconversion;
    $currencyconversion_options = array(
        array("value" => "active", "text" => "Active"),
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-custom.php and 4 other locations - About 5 hrs to fix
wpecomm-mercado-pago-module/mercadopago-basic.php on lines 1107..1128
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1508..1529
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1531..1552
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 1146..1167

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

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 5 locations. Consider refactoring.
Open

function currency_conversion() {
    $currencyconversion = get_option('mercadopago_certified_currencyconversion');
    $currencyconversion = $currencyconversion === false || is_null($currencyconversion) ? "inactive" : $currencyconversion;
    $currencyconversion_options = array(
        array("value" => "active", "text" => "Active"),
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-basic.php and 4 other locations - About 5 hrs to fix
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1508..1529
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1531..1552
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1554..1575
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 1146..1167

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

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 5 locations. Consider refactoring.
Open

function currency_conversion_ticket() {
    $currencyconversion = get_option('mercadopago_ticket_currencyconversion');
    $currencyconversion = $currencyconversion === false || is_null($currencyconversion) ? "inactive" : $currencyconversion;
    $currencyconversion_options = array(
        array("value" => "active", "text" => "Active"),
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-ticket.php and 4 other locations - About 5 hrs to fix
wpecomm-mercado-pago-module/mercadopago-basic.php on lines 1107..1128
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1508..1529
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1531..1552
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1554..1575

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

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 5 locations. Consider refactoring.
Open

function binary() {
    $binary = get_option('mercadopago_custom_binary');
    $binary = $binary === false || is_null($binary) ? "inactive" : $binary;
    $binary_options = array(
        array("value" => "active", "text" => "Active"),
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-custom.php and 4 other locations - About 5 hrs to fix
wpecomm-mercado-pago-module/mercadopago-basic.php on lines 1107..1128
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1531..1552
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1554..1575
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 1146..1167

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

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 5 locations. Consider refactoring.
Open

function sandbox_custom() {
    $sandbox = get_option('mercadopago_custom_sandbox');
    $sandbox = $sandbox === false || is_null($sandbox) ? "inactive" : $sandbox;
    $sandbox_options = array(
        array("value" => "active", "text" => "Active"),
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-custom.php and 4 other locations - About 5 hrs to fix
wpecomm-mercado-pago-module/mercadopago-basic.php on lines 1107..1128
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1508..1529
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1554..1575
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 1146..1167

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

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 3 locations. Consider refactoring.
Open

function category_ticket() {
    $category = get_option('mercadopago_ticket_category');
    $category = $category === false || is_null($category) ? "others" : $category;
    // category marketplace
    $list_category = MPRestClient::get( array( "uri" => "/item_categories" ) );
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-ticket.php and 2 other locations - About 4 hrs to fix
wpecomm-mercado-pago-module/mercadopago-basic.php on lines 1062..1082
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1463..1483

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

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 3 locations. Consider refactoring.
Open

function category_custom() {
    $category = get_option('mercadopago_custom_category');
    $category = $category === false || is_null($category) ? "others" : $category;
    // category marketplace
    $list_category = MPRestClient::get( array( "uri" => "/item_categories" ) );
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-custom.php and 2 other locations - About 4 hrs to fix
wpecomm-mercado-pago-module/mercadopago-basic.php on lines 1062..1082
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 1101..1121

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

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 3 locations. Consider refactoring.
Open

function category() {
    $category = get_option('mercadopago_certified_category');
    $category = $category === false || is_null($category) ? "others" : $category;
    // category marketplace
    $list_category = MPRestClient::get( array( "uri" => "/item_categories" ) );
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-basic.php and 2 other locations - About 4 hrs to fix
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1463..1483
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 1101..1121

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

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 3 locations. Consider refactoring.
Open

function debugs() {
    if (get_option('mercadopago_certified_debug') == null || get_option('mercadopago_certified_debug') == '') {
        $mercadopago_certified_debug = 'No';
    } else {
        $mercadopago_certified_debug = get_option('mercadopago_certified_debug');
Severity: Major
Found in wpecomm-mercado-pago-module/mercadopago-basic.php and 2 other locations - About 4 hrs to fix
wpecomm-mercado-pago-module/mercadopago-custom.php on lines 1577..1594
wpecomm-mercado-pago-module/mercadopago-ticket.php on lines 1169..1186

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

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

Severity
Category
Status
Source
Language