Showing 137 of 365 total issues
Function UserPreferences
has 246 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function UserPreferences() {
const { data } = useGetCurrentUserQuery();
const [loading, setLoading] = React.useState(true);
const [, setUserPreferences] = React.useState<PreferencesForm>({
birthday: "",
File Upload.tsx
has 484 lines of code (exceeds 250 allowed). Consider refactoring. Open
import cx from "classnames";
import React from "react";
import { filterFalsyKeys } from "../../../shared";
import {
Function buildConnectionResolver
has 183 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function buildConnectionResolver<TEntity, TNode = TEntity>(
query: QueryBuilder,
args: {
before?: string | null;
last?: number | null;
Function Routes
has 177 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Routes() {
useVerifyEmail();
return (
<div className="relative">
<div className="toast">
Function AddableFoodMeasurements
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
export function AddableFoodMeasurements({
food,
saveSelectedFood,
}: {
saveSelectedFood: (input: FoodLogInput) => 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 up
has 143 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function up(knex: Knex): Promise<void> {
await withSchema(knex).createTable("user", function (table) {
table.text("id").notNullable().primary();
table.string("preferredName");
table.string("legacyPreferences").nullable();
Function buildConnectionResolver
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export async function buildConnectionResolver<TEntity, TNode = TEntity>(
query: QueryBuilder,
args: {
before?: string | null;
last?: number | 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
File ScannerResults.tsx
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from "react";
import cx from "classnames";
import {
GetCurrentUserFoodLogDocument,
File createDataService.ts
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Knex } from "knex";
import omit from "lodash.omit";
import { ulid } from "ulid";
import { assertIsError } from "../../shared";
File buildConnectionResolver.test.ts
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Knex } from "knex";
import { ulid } from "ulid";
import { getConnection } from "../../config/db";
import { buildConnectionResolver } from "./buildConnectionResolver";
Function Home
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Home() {
const { ratio } = useWindowSize();
const splashImage = React.useMemo(() => {
if (
isWithin({
File seedData.ts
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
import "minifaker/locales/en";
import addDays from "date-fns/addDays";
import subYears from "date-fns/subYears";
import knex from "knex";
Function Application
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Application(): React.ReactComponentElement<any> {
// When the URL changes, scroll to the top
const { pathname, search } = useLocation();
React.useEffect(() => {
document.body.scrollTop = 0;
Function Register
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Register() {
const navigate = useNavigateToUrl();
const registerForm = useForm<{
email: string;
password: string;
File MuscleMap.tsx
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
import cx from "classnames";
import React from "react";
import { Muscle } from "../../generated";
File FoodListItem.tsx
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
import cx from "classnames";
import React from "react";
import { Link, useHistory } from "react-router-dom";
import { or } from "../../../shared";
Function Upload
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export function Upload({
limit = 1,
bodyDrop = true,
type = "IMAGE",
aspectRatio = "1/1",
- 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 UserPreferences.tsx
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from "react";
import { boolean, date, number, object, string } from "yup";
import { getWithDefault, objectEntries } from "../../shared";
import { GhostButton } from "../components/Button/Ghost";
Function userActivitySummary
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const userActivitySummary: UserResolvers["activitySummary"] = async (
parent,
args,
context
) => {
Function ActivityLog
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ActivityLog() {
const { id, day = "" } = useParams<{ id: string; day: string }>();
const { data, loading } = useGetActivityDetailsQuery({
variables: {
id,