recurly/recurly-js

View on GitHub

Showing 80 of 183 total issues

Function parent has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parent () {
    // Check integrity of hostedFields. If fields are dead or
    // do not match chosen selectors, reset
    let reset = (
      this.hostedFields
Severity: Minor
Found in lib/recurly.js - About 1 hr to fix

    Function getTieredPricingValues has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function getTieredPricingValues (
      addOn,
      selectedNumUnits,
      currencyCode,
    ) {
    Severity: Minor
    Found in lib/recurly/pricing/subscription/tiered-pricing-calculator.js - About 1 hr to fix

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

        activateKountProfile (params) {
          debug('activating Kount profiles');
          const configuredForm = this.recurly.config.fraud.kount.form;
          const sessionIdInputElement = dom.createHiddenInput({
            'data-recurly': 'fraud_session_id',
      Severity: Minor
      Found in lib/recurly/fraud.js - About 1 hr to fix

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

          subscription (subscription) {
            return new PricingPromise((resolve, reject) => {
              if (!(subscription instanceof SubscriptionPricing)) {
                return this.error(errors('invalid-option', {
                  name: 'subscription',
        Severity: Minor
        Found in lib/recurly/pricing/checkout/index.js - About 1 hr to fix

          Function attach has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            attach (element) {
              super.attach(element);
          
          
              this.whenReady(() => {
          Severity: Minor
          Found in lib/recurly/risk/three-d-secure/strategy/braintree.js - About 1 hr to fix

            Function token has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function token (customerData, bus, done) {
              debug('token');
              debug('customerData', customerData);
            
              const inputs = customerData.values;
            Severity: Minor
            Found in lib/recurly/token.js - About 1 hr to fix

              Function getGoogleInfoFromMerchantInfo has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const getGoogleInfoFromMerchantInfo = (recurlyMerchantInfo, options) => {
                const { siteMode, paymentMethods } = recurlyMerchantInfo;
                const { environment: envOpt, } = options;
                const environment = envOpt || (siteMode === 'production' ? 'PRODUCTION' : 'TEST');
              
              
              Severity: Minor
              Found in lib/recurly/google-pay/google-pay.js - About 1 hr to fix

                Function preflight has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  static preflight ({ recurly, number, jwt, deviceDataCollectionUrl }) {
                    const { preflightDeviceDataCollector } = recurly.config.risk.threeDSecure;
                
                    if(!preflightDeviceDataCollector) {
                      return Promise.resolve();
                Severity: Minor
                Found in lib/recurly/risk/three-d-secure/strategy/worldpay.js - About 1 hr to fix

                  Function parent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    parent () {
                      // Check integrity of hostedFields. If fields are dead or
                      // do not match chosen selectors, reset
                      let reset = (
                        this.hostedFields
                  Severity: Minor
                  Found in lib/recurly.js - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function plan has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    plan (...args) {
                      let { currentPlan, quantity, planCode, done } = this.subscription.resolvePlanOptions(...args);
                  
                      return new PricingPromise((resolve, reject) => {
                        if (currentPlan && currentPlan.code === planCode) {
                  Severity: Minor
                  Found in lib/recurly/pricing/subscription/embedded.js - About 1 hr to fix

                    Function token has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function token (options, done) {
                      debug('token');
                    
                      const data = normalize(options, FIELDS);
                      const inputs = data.values;
                    Severity: Minor
                    Found in lib/recurly/bank-account.js - About 1 hr to fix

                      Function tokenDispatcher has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function tokenDispatcher (...args) {
                        let bus, elements, customerData, done;
                      
                        // signature variance
                        if (args[0] instanceof Elements) {
                      Severity: Minor
                      Found in lib/recurly/token.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function token has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function token (customerData, bus, done) {
                        debug('token');
                        debug('customerData', customerData);
                      
                        const inputs = customerData.values;
                      Severity: Minor
                      Found in lib/recurly/token.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function discountAmounts has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        discountAmounts () {
                          const coupon = this.items.coupon;
                          let discountNow = 0;
                          let discountNext = 0;
                          if (coupon) {
                      Severity: Minor
                      Found in lib/recurly/pricing/checkout/calculations.js - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function createAndMountWebComponent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        async createAndMountWebComponent (paymentMethodData) {
                          const adyenOpts = this.options.adyen || {};
                      
                          const checkout = await window.AdyenCheckout({
                            clientKey: adyenOpts.publicKey,
                      Severity: Minor
                      Found in lib/recurly/alternative-payment-methods/gateways/adyen.js - About 1 hr to fix

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

                        function runner (config) {
                          const cfg = Object.assign({}, staticConfig, {
                            reporters: ['mocha'],
                            logLevel: config.LOG_INFO,
                            browsers: [BROWSER],
                        Severity: Minor
                        Found in karma.ci.conf.js - About 1 hr to fix

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

                            attach (element) {
                              super.attach(element);
                              debug('Initiating 3D Secure frame');
                          
                              const {
                          Severity: Minor
                          Found in lib/recurly/risk/three-d-secure/strategy/paypal-complete.js - About 1 hr to fix

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

                              coupon (newCoupon, done) {
                                // If the new coupon matches the current one, we just need to ensure it
                                // still applies to the current plan
                                if (~this.couponCodes.indexOf(newCoupon)) {
                                  return new PricingPromise((resolve, reject) => {
                            Severity: Minor
                            Found in lib/recurly/pricing/subscription/index.js - About 1 hr to fix

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

                                params (data) {
                                  const { fraud: fraudConfig } = this.recurly.config;
                                  let fraudParams = [];
                                  debug('creating fraud params', data, fraudConfig);
                              
                              
                              Severity: Minor
                              Found in lib/recurly/fraud.js - About 1 hr to fix

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

                                  tax (done) {
                                    this.price.now.tax = 0;
                                    this.price.next.tax = 0;
                                
                                    // If tax amount has been specified, simply apply it
                                Severity: Minor
                                Found in lib/recurly/pricing/subscription/calculations.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language