Showing 80 of 183 total issues
Function configure
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
configure (options) {
if (options.recurly) this.recurly = options.recurly;
else return this.initError = this.error('apple-pay-factory-only');
if (options.callbacks) this.config.callbacks = options.callbacks;
- Read upRead up
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 tax
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function tax () {
if (this.query.country === 'US' && this.query.postal_code === USST_POSTAL_CODE && this.query.tax_code === USST_TAX_CODE) return usstWithTaxCode;
if (this.query.country === 'US' && this.query.postal_code === USST_POSTAL_CODE) return usst;
if (this.query.country === 'US' && this.query.postal_code === USST_POSTAL_CODE_WITH_REGION) return usstWithRegion;
if (this.query.country === VAT_COUNTRY) return vat;
- Read upRead up
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 recurlyErrorFactory
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function recurlyErrorFactory (definition) {
const { code, message, help } = definition;
/**
* Recurly domain-specific error class
- Read upRead up
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 validateOptions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async validateOptions () {
const getMissingField = (options, fields) => {
for(const field of fields) {
if (!(field in options)) {
return field;
- Read upRead up
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
Avoid too many return
statements within this function. Open
return BANK_ACCOUNT_TOKENS[params.account_number];
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return require('./checkout-session-token.json');
Avoid too many return
statements within this function. Open
return CREATE_INVALID;
Avoid too many return
statements within this function. Open
if (this.query.country === VAT_2015_COUNTRY) return vat2015;
Avoid too many return
statements within this function. Open
return none;
Function toLegacyLauncher
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function toLegacyLauncher (capability) {
const capabilities = Object.assign({}, capability);
const translations = {
browserName: 'browser',
browserVersion: 'browser_version',
- Read upRead up
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 inject
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
inject () {
FIELD_TYPES.forEach(type => {
try {
this.fields.push(new HostedField(this.fieldConfig(type)));
this.initQueue.push(type);
- Read upRead up
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 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');
- Read upRead up
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;
- Read upRead up
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;
- Read upRead up
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 validatePayload
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function validatePayload (payload) {
var errors = [];
if (payload.skinCode && payload.skinCode.length != 8) {
errors.push('skinCode should be 8 characters');
- Read upRead up
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 getCollectorProfiles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getCollectorProfiles () {
if (this.dataCollectorInitiated) return;
this.dataCollectorInitiated = true;
this.recurly.request.get({
- Read upRead up
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
- Read upRead up
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 resolvePlanOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
resolvePlanOptions (planCode, options = {}, done) {
let plan = this.items.plan;
let quantity;
if (typeof options === 'function') {
- Read upRead up
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 destroy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
destroy () {
const { iframe, window: frameWindow } = this;
if (iframe) {
const { parentElement } = iframe;
- Read upRead up
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"