Showing 45 of 47 total issues
Function Activate
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Activate = (props: { id: string; token: string }) => {
const [passwordField1, setPasswordField1] = useState("")
const [passwordField2, setPasswordField2] = useState("")
const [attempts, setAttempts] = useState(0)
Function SEO
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
export const SEO = ({
defaultMeta,
defaultTitle,
pagePath,
metaInfo,
- 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 handler
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const handler = async (event: APIGatewayEvent): Promise<any> => {
if (event.httpMethod !== 'POST' || !event.body) {
return statusReturn(400, '')
}
Function Reset
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Reset = (props: {
path: string
id?: string
token?: string
}) => {
Function getIcon
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getIcon = (name, color = 'currentColor') => {
switch (name) {
case 'facebook':
return (
<path
Function updateEverything
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
const updateEverything = async (data: {
id: number
title: string
variants: any[]
handle: string
Function handler
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export const handler = async (event: APIGatewayEvent): Promise<any> => {
if (event.httpMethod !== 'POST' || !event.body) {
return statusReturn(400, '')
}
- 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 createAllPages
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.createAllPages = (
promiseResults,
actions,
resolve,
reject
Function Orders
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Orders = () => {
const {customerToken} = useStore()
const [orders, setOrders] = useState([])
const handleOrders = useCallback(
(token) =>
Function ProductForm
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export const ProductForm = ({ slug, defaultPrice, productId, showQuantity, waitlist = true, addText }: {
defaultPrice: string
slug?: {
current: string
}
- 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
File siteContext.tsx
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
{
/*
Orginal Author of this file: https://github.com/thetrevorharmon
Orginal File: https://github.com/thetrevorharmon/sell-things-fast/blob/master/src/context/StoreContext.js
Function CartDrawer
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const CartDrawer = () => {
const lineItems = useCartItems()
const { cartIsOpen } = useStore()
const { total } = useCartTotals()
const toggleCart = useToggleCart()
Function handler
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const handler = async (event: APIGatewayEvent): Promise<any> => {
// TEST for POST request
if (event.httpMethod !== 'POST' || !event.body) {
return statusReturn(400, '')
}
Function handler
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const handler = async (event: APIGatewayEvent): Promise<any> => {
// TEST for POST request
if (event.httpMethod !== 'POST' || !event.body) {
return statusReturn(400, '')
Function handler
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const handler = async (event: APIGatewayEvent): Promise<any> => {
if (event.httpMethod !== 'POST' || !event.body) return statusReturn(400, {})
try {
data = JSON.parse(event.body)
Function Activate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const Activate = (props: { id: string; token: string }) => {
const [passwordField1, setPasswordField1] = useState("")
const [passwordField2, setPasswordField2] = useState("")
const [attempts, setAttempts] = useState(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 Register
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export const Register = ({path}: {path: string}) => {
const [passwordField1, setPasswordField1] = useState("")
const [passwordField2, setPasswordField2] = useState("")
const form = React.createRef() as React.RefObject<HTMLFormElement>
const [attempts, setAttempts] = useState(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 verifyAccount
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async e => {
setAttempts(attempts + 1)
if (passwordField1 !== passwordField2) {
await Timeout.set(400)
Function handler
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const handler = async (event: APIGatewayEvent): Promise<any> => {
if (event.httpMethod !== "POST" || !event.body) return statusReturn(400, '')
try {
data = JSON.parse(event.body)
Function handleRegister
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
async (email, password, firstName, lastName) => {
setAttempts(attempts + 1)
if (!PasswordSchema.validate(passwordField1)) {
throw new Error(