recurly/recurly-js

View on GitHub

Showing 80 of 183 total issues

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

  async validateOptions () {
    const getMissingField = (options, fields) => {
      for(const field of fields) {
        if (!(field in options)) {
          return field;

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

      constructor (pricing, done) {
        this.pricing = pricing;
        this.items = pricing.items;
        this._itemizedSets = { now: {}, next: {} };
    
    
    Severity: Minor
    Found in lib/recurly/pricing/checkout/calculations.js - About 1 hr to fix

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

      export default function buildApplePayPaymentRequest (applePay, options, cb) {
        const { recurly, config } = applePay;
        const paymentRequest = {
          currencyCode: options.currency,
          countryCode: options.country,
      Severity: Minor
      Found in lib/recurly/apple-pay/util/build-apple-pay-payment-request.js - About 1 hr to fix

        Function token has a Cognitive Complexity of 10 (exceeds 5 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

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

          addon (addonCode, meta, done) {
            if (typeof meta === 'function') {
              done = meta;
              meta = undefined;
            }
        Severity: Minor
        Found in lib/recurly/pricing/subscription/index.js - About 1 hr to fix

          Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor (pricing, done) {
              this.pricing = pricing;
              this.items = pricing.items;
          
              this.price = {
          Severity: Minor
          Found in lib/recurly/pricing/subscription/calculations.js - About 1 hr to fix

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

              discountableSubtotals (coupon, { setupFees = true, taxExempt = true } = {}) {
                let discountableNow = 0;
                let discountableNext = 0;
            
                // adjustments
            Severity: Minor
            Found in lib/recurly/pricing/checkout/calculations.js - About 1 hr to fix

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

              function toLegacyLauncher (capability) {
                const capabilities = Object.assign({}, capability);
                const translations = {
                  browserName: 'browser',
                  browserVersion: 'browser_version',
              Severity: Minor
              Found in karma.ci.conf.js - About 1 hr to fix

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

                  getHostedFieldParentForm () {
                    if (this._form) return this._form;
                    const fields = this.recurly.config.fields;
                    debug('form fields', fields);
                    const selectors = Object.keys(fields)
                Severity: Minor
                Found in lib/recurly/fraud.js - About 1 hr to fix

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

                    initialize () {
                      debug('Initializing Braintree client');
                  
                      const authorization = this.config.clientAuthorization;
                      const braintree = window.braintree;
                  Severity: Minor
                  Found in lib/recurly/venmo/strategy/braintree.js - About 1 hr to fix

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

                      discountableSubtotals (coupon, { setupFees = true, taxExempt = true } = {}) {
                        let discountableNow = 0;
                        let discountableNext = 0;
                    
                        // adjustments
                    Severity: Minor
                    Found in lib/recurly/pricing/checkout/calculations.js - About 55 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function valueGet has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function valueGet (node) {
                      node = element(node);
                    
                      var nodeType = node && node.type && node.type.toLowerCase();
                      var value;
                    Severity: Minor
                    Found in lib/util/dom.js - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function buildApplePayPaymentRequest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function buildApplePayPaymentRequest (applePay, options, cb) {
                      const { recurly, config } = applePay;
                      const paymentRequest = {
                        currencyCode: options.currency,
                        countryCode: options.country,
                    Severity: Minor
                    Found in lib/recurly/apple-pay/util/build-apple-pay-payment-request.js - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function payWithGoogle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const payWithGoogle = ({ paymentOptions, isReadyToPayRequest, paymentDataRequest, buttonOptions }) => {
                      const { paymentDataCallbacks } = paymentOptions;
                    
                      if (paymentDataCallbacks) {
                        const { onPaymentAuthorized, onPaymentDataChanged } = paymentDataCallbacks;
                    Severity: Minor
                    Found in lib/recurly/google-pay/pay-with-google.js - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function element has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function element (node) {
                      var jQuery = window.jQuery;
                      var isJQuery = jQuery && node instanceof jQuery;
                      var isElem;
                    
                    
                    Severity: Minor
                    Found in lib/util/dom.js - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function taxes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      taxes () {
                        let taxNow = this.price.now.taxes = 0;
                        let taxNext = this.price.next.taxes = 0;
                    
                        // If tax amount has been specified, simply apply it
                    Severity: Minor
                    Found in lib/recurly/pricing/checkout/calculations.js - About 45 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function tokens has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function tokens () {
                      const params = this.method === 'GET' ? this.query : this.request.body;
                      const { type } = params;
                    
                      if (type === 'iban_bank_account') {
                    Severity: Minor
                    Found in packages/public-api-fixture-server/fixtures/tokens/index.js - About 35 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function classList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      get classList () {
                        const prefix = 'recurly-hosted-field';
                        let classes = [prefix];
                    
                        if (this.ready) {
                    Severity: Minor
                    Found in lib/recurly/hosted-field.js - About 35 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function classList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      get classList () {
                        const { attached, state, type } = this;
                        const prefix = 'recurly-element';
                        let classes = [prefix];
                    
                    
                    Severity: Minor
                    Found in lib/recurly/element/element.js - About 35 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function configure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      configure (options) {
                        if (!(options.recurly instanceof Recurly)) throw this.error('paypal-factory-only');
                        this.recurly = options.recurly;
                        if (options.gatewayCode) this.config.gatewayCode = options.gatewayCode;
                    
                    
                    Severity: Minor
                    Found in lib/recurly/paypal/strategy/index.js - About 35 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language