recurly/recurly-js

View on GitHub

Showing 184 of 184 total issues

Function cardType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function cardType (number, partial = false) {
  const cardNumber = parseCard(number);
  const compareLength = Math.min(cardNumber.length, 6);

  const compareValue = buildCompareValue(cardNumber, compareLength, '0');
Severity: Minor
Found in lib/recurly/validate.js - About 25 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 prepare has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  prepare (path, payload) {
    const { name, recurly } = this;
    debug('creating request frame');

    payload.version = recurly.version;
Severity: Minor
Found in lib/recurly/frame.js - About 25 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 finalizeApplePayPaymentRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function finalizeApplePayPaymentRequest (paymentRequest, config) {
  if (paymentRequest.billingContact && paymentRequest.shippingContact) return paymentRequest;

  const formAddress = config.form
    ? normalize(config.form, ADDRESS_FIELDS, { parseCard: false }).values
Severity: Minor
Found in lib/recurly/apple-pay/util/finalize-apple-pay-payment-request.js - About 25 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 discount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  discount () {
    var coupon = this.items.coupon;

    this.price.now.discount = 0;
    this.price.next.discount = 0;
Severity: Minor
Found in lib/recurly/pricing/subscription/calculations.js - About 25 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