Showing 35 of 71 total issues
File index.js
has 636 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Platform } from 'react-native';
import { getShippingOptions } from '../services/shipping';
// helpers
function addStringAmounts(...prices) {
Function render
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<View
style={{
margin: 30,
File index.js
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// @flow
'use strict';
// Types
import type {
File ReactNativePaymentsModule.java
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package com.reactnativepayments;
import android.view.WindowManager;
import android.app.Activity;
Function staticShipping
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function staticShipping() {
let details = {
id: 'staticShipping',
displayItems: [
{
Method onActivityResult
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
// retrieve the error code, if available
int errorCode = -1;
if (data != null) {
- 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
Method onActivityResult
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
// retrieve the error code, if available
int errorCode = -1;
if (data != null) {
Function dynamicShipping
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function dynamicShipping() {
let details = {
id: 'dynamicShipping',
displayItems: [
{
Function noInternationalShipping
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function noInternationalShipping() {
let details = {
id: 'noInternationalShipping',
displayItems: [
{
Function constructor
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
methodData: Array<PaymentMethodData> = [],
details?: PaymentDetailsInit = [],
options?: PaymentOptions = {}
) {
Function errorInvalidShippingOptionsAmount
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function errorInvalidShippingOptionsAmount() {
let details = {
id: 'errorInvalidShippingOptionsAmount',
displayItems: [
{
Function _handleDetailsChange
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_handleDetailsChange(value: PaymentDetailsBase) {
const target = this.target;
validateTotal(value.total, DOMException);
validateDisplayItems(value.displayItems, DOMException);
Function validateShippingOptions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function validateShippingOptions(details, errorType = Error): void {
if (details.shippingOptions === undefined) {
return undefined;
}
Function render
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
return (
<View
style={{
margin: 30,
- 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 errorDuplicateShippingOptionsId
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function errorDuplicateShippingOptionsId() {
let details = {
id: 'errorDuplicateShippingOptionsId',
displayItems: [
{
Function updateDetailsWithMutation
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateDetailsWithMutation(
paymentRequest,
details,
nextShippingOptions
) {
Function _getPlatformDetailsIOS
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_getPlatformDetailsIOS(details: PaymentDetailsIOSRaw): PaymentDetailsIOS {
const {
paymentData: serializedPaymentData,
billingContact: serializedBillingContact,
shippingContact: serializedShippingContact,
Function twoItemsPlusTax
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function twoItemsPlusTax() {
const displayItems = [
{
label: 'Movie Ticket',
amount: { currency: 'USD', value: 15.0 }
Function hasGatewayConfig
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function hasGatewayConfig(platformMethodData = {}) {
if (!platformMethodData) {
return false;
}
Function updateWith
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async updateWith(
PaymentDetailsModifierOrPromise:
| PaymentDetailsUpdate
| ((
PaymentDetailsModifier,