Showing 137 of 365 total issues
Function AddableFood
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function AddableFood({
day,
selected,
setSelected,
food,
- 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 authenticate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export async function authenticate(
request: Request,
context: Context
): Promise<AuthenticationResult | undefined> {
const authToken: string | undefined = request.cookies?.w8mngrAuth;
- 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 requestDidStart
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
requestDidStart: async () => {
return {
willSendResponse: async (requestContext) => {
const { context } =
requestContext as GraphQLRequestContext<Context>;
- 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 PageHeading
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function PageHeading(props: PageHeadingProps) {
return (
<div className="flex gap-4 items-center">
{props.icon && (
<div
Function popular
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function popular(context: Context): Promise<Activity[]> {
const userId = context.getCurrentUserId(true);
const activityLogQueryFactory = await getActivityLogQuery(context);
const popularQuery = activityLogQueryFactory();
const popularActivityIds: { activityId: string }[] = await popularQuery
Function seedFoods
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function seedFoods() {
console.log("Seeding legacy food entries into the new food entries table");
let hasMore = true;
let offset = 0;
Function allowedElements
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const allowedElements = React.useMemo<string[]>(() => {
return props.textOnly
? []
: [
"h1",
Function saveActivityLog
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const saveActivityLog: MutationResolvers["saveActivityLog"] = async (
parent,
args,
context
) => {
Function saveActivityEntries
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function saveActivityEntries() {
console.log("Seeding activity entries");
let total = 0;
function randomRepsAndWork(type: Activity["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 orZero
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function orZero(value: any): number {
if (typeof value === "number") return value;
if (typeof value === "string") {
const num = parseInt(value, 10);
if (num < 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 FoodMeasurementsForm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function FoodMeasurementsForm({
initialData = [],
onChange,
}: {
initialData?: Maybe<FormMeasurementInput[]>;
- 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 runHandlerIfKeyMatches
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function runHandlerIfKeyMatches(
userKey: "up" | "down" | "left" | "right" | "enter" | "esc",
event: KeyboardEvent,
handler: (event: KeyboardEvent) => void
) {
- 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 FoodsListItem
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function FoodsListItem({
id,
name,
description,
previewImageUrl,
- 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 foodLogLocalStorage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function foodLogLocalStorage() {
const getItems = () => {
const storedItems = window.localStorage.getItem("foodLogEntries");
if (storedItems) {
try {
- 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 saveMutation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function saveMutation(
context: Context,
{
input,
userId,
- 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 numberToContextualUnit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export async function numberToContextualUnit(
context: Context,
{
work,
activityType,
- 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 WeightLog
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function WeightLog() {
const { day } = useParams<{ day?: string }>();
const dayString = React.useMemo(() => {
if (!day) {
return dayStringFromDate(new Date());
- 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 undefined;
Avoid too many return
statements within this function. Open
if (userKey === "left" && eventKey !== "ArrowLeft") return;
Avoid too many return
statements within this function. Open
return 0;