Showing 80 of 183 total issues
File errors.js
has 383 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Reporter } from './reporter';
import squish from 'string-squish';
const BASE_URL = 'https://dev.recurly.com/docs/recurly-js-';
const GOOGLE_PAY_ERRORS = [
Function onInputChange
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
onInputChange (event) {
debug('onInputChange');
const elems = this.elements;
File index.js
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
import clone from 'component-clone';
import find from 'component-find';
import intersection from 'intersect';
import isEmpty from 'lodash.isempty';
import Promise from 'promise';
File calculations.js
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
import each from 'component-each';
import isEmpty from 'lodash.isempty';
import Promise from 'promise';
import uniq from 'array-unique';
import decimalizeMember from '../../../util/decimalize-member';
Element
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Element extends Emitter {
static DATA_ATTRIBUTE_ID = 'recurlyElementId';
static FRAME_NAME_PREFIX = 'recurly-element--';
static INSTANCE_REF_NAME = '__recurlyElement';
static OPTIONS = [
File recurly.js
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*jshint -W058 */
import clone from 'component-clone';
import deepAssign from './util/deep-assign';
import deepFilter from 'deep-filter';
Function configure
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
configure (options) {
debug('configure');
options = clone(options);
if (typeof options === 'string') options = { publicKey: options };
- 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 adjustment
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
adjustment ({ itemCode = null, amount, quantity, id = uid(), currency, taxExempt, taxCode }) {
const { recurly } = this;
return new PricingPromise((resolve, reject) => {
let existingAdjustment = find(this.items.adjustments, a => a.id === id);
let validateAmount = true;
Function change
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
change (event) {
debug('change');
const elems = this.elements;
const target = event.target || event.srcElement;
- 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
ApplePay
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export class ApplePay extends Emitter {
constructor (options) {
super();
this._ready = false;
CheckoutPricing
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export default class CheckoutPricing extends Pricing {
constructor (...args) {
super(...args);
this.debug = debug;
this.recurly.report('pricing:checkout:create');
Function change
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
change (event) {
debug('change');
const elems = this.elements;
const target = event.target || event.srcElement;
File apple-pay.js
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Emitter from 'component-emitter';
import errors from '../errors';
import { normalize } from '../../util/normalize';
import { NON_ADDRESS_FIELDS } from '../token';
import { Pricing } from '../pricing';
Function taxes
has 56 lines of code (exceeds 25 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
Function configure
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
configure (options) {
debug('configure');
options = clone(options);
if (typeof options === 'string') options = { publicKey: options };
File element.js
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
import deepAssign from '../../util/deep-assign';
import dom from '../../util/dom';
import Emitter from 'component-emitter';
import find from 'component-find';
import pick from 'lodash.pick';
Function transformAddress
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function transformAddress (source, { to = 'contact', except = [], map = CONTACT_MAP } = {}) {
if (isEmpty(source)) return null;
const target = Object.keys(map).reduce((target, addressField) => {
const contactField = map[addressField];
- 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 xhr
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
xhr ({ method, url, data }) {
const error = (...args) => this.recurly.error(...args);
return new Promise((resolve, reject) => {
let req = new XHR;
Function deepAssign
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export default function deepAssign (target, ...sources) {
if (!sources.length) return target;
const source = sources.shift();
if (isAssignableObject(target) && isAssignableObject(source)) {
- 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 preflight
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
static preflight ({ recurly, number, month, year, gateway_code }) {
const { preflightDeviceDataCollector } = recurly.config.risk.threeDSecure;
if(!preflightDeviceDataCollector) {
return Promise.resolve();