naoufal/react-native-apple-pay

View on GitHub
examples/common/handlers/index.js

Summary

Maintainability
F
1 wk
Test Coverage

File index.js has 636 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Platform } from 'react-native';
import { getShippingOptions } from '../services/shipping';

// helpers
function addStringAmounts(...prices) {
Severity: Major
Found in examples/common/handlers/index.js - About 1 day to fix

    Function staticShipping has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function staticShipping() {
      let details = {
        id: 'staticShipping',
        displayItems: [
          {
    Severity: Major
    Found in examples/common/handlers/index.js - About 2 hrs to fix

      Function dynamicShipping has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function dynamicShipping() {
        let details = {
          id: 'dynamicShipping',
          displayItems: [
            {
      Severity: Minor
      Found in examples/common/handlers/index.js - About 1 hr to fix

        Function noInternationalShipping has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function noInternationalShipping() {
          let details = {
            id: 'noInternationalShipping',
            displayItems: [
              {
        Severity: Minor
        Found in examples/common/handlers/index.js - About 1 hr to fix

          Function errorInvalidShippingOptionsAmount has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function errorInvalidShippingOptionsAmount() {
            let details = {
              id: 'errorInvalidShippingOptionsAmount',
              displayItems: [
                {
          Severity: Minor
          Found in examples/common/handlers/index.js - About 1 hr to fix

            Function errorDuplicateShippingOptionsId has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function errorDuplicateShippingOptionsId() {
              let details = {
                id: 'errorDuplicateShippingOptionsId',
                displayItems: [
                  {
            Severity: Minor
            Found in examples/common/handlers/index.js - About 1 hr to fix

              Function updateDetailsWithMutation has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function updateDetailsWithMutation(
                paymentRequest,
                details,
                nextShippingOptions
              ) {
              Severity: Minor
              Found in examples/common/handlers/index.js - About 1 hr to fix

                Function twoItemsPlusTax has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function twoItemsPlusTax() {
                  const displayItems = [
                    {
                      label: 'Movie Ticket',
                      amount: { currency: 'USD', value: 15.0 }
                Severity: Minor
                Found in examples/common/handlers/index.js - About 1 hr to fix

                  Function errorNoShippingOptions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function errorNoShippingOptions() {
                    let details = {
                      id: 'errorNoShippingOptions',
                      displayItems: [
                        {
                  Severity: Minor
                  Found in examples/common/handlers/index.js - About 1 hr to fix

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

                    export function requestPayerName() {
                      const details = {
                        id: 'requestPayerName',
                        displayItems: [
                          {
                    Severity: Major
                    Found in examples/common/handlers/index.js and 2 other locations - About 4 hrs to fix
                    examples/common/handlers/index.js on lines 186..204
                    examples/common/handlers/index.js on lines 206..224

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

                    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

                    export function requestPayerPhone() {
                      const details = {
                        id: 'requestPayerPhone',
                        displayItems: [
                          {
                    Severity: Major
                    Found in examples/common/handlers/index.js and 2 other locations - About 4 hrs to fix
                    examples/common/handlers/index.js on lines 166..184
                    examples/common/handlers/index.js on lines 206..224

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

                    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

                    export function requestPayerEmail() {
                      const details = {
                        id: 'requestPayerEmail',
                        displayItems: [
                          {
                    Severity: Major
                    Found in examples/common/handlers/index.js and 2 other locations - About 4 hrs to fix
                    examples/common/handlers/index.js on lines 166..184
                    examples/common/handlers/index.js on lines 186..204

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

                    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

                      let details = {
                        id: 'noInternationalShipping',
                        displayItems: [
                          {
                            label: 'Movie Ticket',
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 3 hrs to fix
                    examples/common/handlers/index.js on lines 351..368

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

                    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

                      let details = {
                        id: 'dynamicShipping',
                        displayItems: [
                          {
                            label: 'Movie Ticket',
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 3 hrs to fix
                    examples/common/handlers/index.js on lines 470..487

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

                    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

                    export function errorInvalidTotalAmount() {
                      let details = {
                        id: 'errorNoShippingOptions',
                        displayItems: [
                          {
                    Severity: Major
                    Found in examples/common/handlers/index.js and 2 other locations - About 3 hrs to fix
                    examples/common/handlers/index.js on lines 538..555
                    examples/common/handlers/index.js on lines 576..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 107.

                    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

                    export function errorInvalidDisplayItemAmount() {
                      let details = {
                        id: 'errorNoShippingOptions',
                        displayItems: [
                          {
                    Severity: Major
                    Found in examples/common/handlers/index.js and 2 other locations - About 3 hrs to fix
                    examples/common/handlers/index.js on lines 538..555
                    examples/common/handlers/index.js on lines 557..574

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

                    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

                    export function errorNegativeTotal() {
                      let details = {
                        id: 'errorNegativeTotal',
                        displayItems: [
                          {
                    Severity: Major
                    Found in examples/common/handlers/index.js and 2 other locations - About 3 hrs to fix
                    examples/common/handlers/index.js on lines 557..574
                    examples/common/handlers/index.js on lines 576..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 107.

                    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

                      details.displayItems = details.displayItems.map(displayItem => {
                        if (displayItem.label === 'Shipping') {
                          return Object.assign({}, displayItem, {
                            amount: {
                              currency: 'USD',
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 3 hrs to fix
                    examples/common/handlers/index.js on lines 302..315

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

                    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

                        details.displayItems = details.displayItems.map(displayItem => {
                          if (displayItem.label === 'Shipping') {
                            return Object.assign({}, displayItem, {
                              amount: {
                                currency: 'USD',
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 3 hrs to fix
                    examples/common/handlers/index.js on lines 423..436

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

                    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

                        shippingOptions: [
                          {
                            id: 'economy',
                            label: 'Economy Shipping',
                            amount: { currency: 'USD', value: '0.00' },
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 1 hr to fix
                    examples/common/handlers/index.js on lines 454..467

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

                    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 [
                        {
                          id: 'economy',
                          label: 'Economy Shipping',
                          amount: { currency: 'USD', value: '0.00' },
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 1 hr to fix
                    examples/common/handlers/index.js on lines 267..280

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

                    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

                      details.total = Object.assign({}, details.total, {
                        amount: {
                          currency: details.total.amount.currency,
                          value: addDisplayItems(details.displayItems)
                        }
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 1 hr to fix
                    examples/common/handlers/index.js on lines 318..323

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

                    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

                        details.total = Object.assign({}, details.total, {
                          amount: {
                            currency: details.total.amount.currency,
                            value: addDisplayItems(details.displayItems)
                          }
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 1 hr to fix
                    examples/common/handlers/index.js on lines 439..444

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

                    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

                        const updateDetailsWithPromise = new Promise((resolve, reject) => {
                          updateDetailsWithMutation(
                            paymentRequest,
                            details,
                            getShippingOptionsForCountry(paymentRequest.shippingAddress.country)
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 1 hr to fix
                    examples/common/handlers/index.js on lines 374..385

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

                    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

                        const updateDetailsWithPromise = new Promise((resolve, reject) => {
                          updateDetailsWithMutation(
                            paymentRequest,
                            details,
                            getShippingOptionsForState(paymentRequest.shippingAddress.region)
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 1 hr to fix
                    examples/common/handlers/index.js on lines 493..504

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

                    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

                      details.shippingOptions = details.shippingOptions.map(shippingOption =>
                        Object.assign({}, shippingOption, {
                          selected: shippingOption.id === paymentRequest.shippingOption
                        })
                      );
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 1 hr to fix
                    examples/common/handlers/index.js on lines 291..295

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

                    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

                        details.shippingOptions = details.shippingOptions.map(shippingOption =>
                          Object.assign({}, shippingOption, {
                            selected: shippingOption.id === paymentRequest.shippingOption
                          })
                        );
                    Severity: Major
                    Found in examples/common/handlers/index.js and 1 other location - About 1 hr to fix
                    examples/common/handlers/index.js on lines 412..416

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

                    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

                      const displayItems = [
                        {
                          label: 'Movie Ticket',
                          amount: { currency: 'USD', value: 15.0 }
                        },
                    Severity: Minor
                    Found in examples/common/handlers/index.js and 1 other location - About 55 mins to fix
                    examples/common/handlers/index.js on lines 110..119

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

                    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

                      const displayItems = [
                        {
                          label: 'Movie Ticket',
                          amount: { currency: 'USD', value: 15.0 }
                        },
                    Severity: Minor
                    Found in examples/common/handlers/index.js and 1 other location - About 55 mins to fix
                    examples/common/handlers/index.js on lines 134..143

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

                    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

                      paymentRequest.addEventListener('shippingoptionchange', e => {
                        updateDetailsWithMutation(
                          paymentRequest,
                          details,
                          getShippingOptionsForState(paymentRequest.shippingAddress.region)
                    Severity: Minor
                    Found in examples/common/handlers/index.js and 1 other location - About 45 mins to fix
                    examples/common/handlers/index.js on lines 508..516

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

                    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

                      paymentRequest.addEventListener('shippingoptionchange', e => {
                        updateDetailsWithMutation(
                          paymentRequest,
                          details,
                          getShippingOptionsForCountry(paymentRequest.shippingAddress.country)
                    Severity: Minor
                    Found in examples/common/handlers/index.js and 1 other location - About 45 mins to fix
                    examples/common/handlers/index.js on lines 390..398

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status