Showing 21 of 91 total issues
File dataCenters.ts
has 1458 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
export const dataCenters = [
{
group: "Africa",
name: "Antananarivo, Madagascar",
id: "TNR",
Function Home
has 405 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Home = () => {
const { hasToken, hasKey } = useSettings();
if (hasKey || hasToken) return <Redirect to="/accounts" />;
Function Settings
has 302 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Settings = forwardRef((props, ref) => {
const homeMatch = useRouteMatch({
path: "/",
exact: true,
}) as Record<string, any>;
Function Analytics
has 286 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Analytics = () => {
const { workerID: scriptID, accountID } = useParams();
const now = new Date();
const defaultDateFrom = new Date(now);
Function Container
has 247 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Container = () => {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const [profileDropdownOpen, setProfileDropdownOpen] = useState(false);
const location = useLocation();
File Analytics.tsx
has 436 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useState } from "react";
import Plot from "react-plotly.js";
import { BigStatus } from "../BigStatus";
import { useQuery, gql } from "@apollo/client";
import { useParams } from "react-router-dom";
File Home.tsx
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { Link, Redirect } from "react-router-dom";
import { ExampleEditor } from "../components/home/ExampleEditor";
import { ExampleAnalytics } from "../components/home/ExampleAnalytics";
import { ExamplePeek } from "../components/home/ExamplePeek";
Function Worker
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Worker: FC = () => {
const { workerID: scriptID, accountID } = useParams();
const { path, url } = useRouteMatch();
const history = useHistory();
const location = useLocation();
Function analyticsToSeries
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const analyticsToSeries = (analytics: any, interval: string) => {
const min = {
x: [] as Date[],
y: [] as number[],
type: "scatter",
File analytics.ts
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import gql from "graphql-tag";
import {
GraphQLResolveInfo,
DocumentNode,
FieldNode,
Function Workers
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Workers: FC<{}> = ({}) => {
const { url } = useRouteMatch();
const { accountID } = useParams();
const { loading, error, data } = useQuery(WORKERS_QUERY, {
variables: { accountID },
File Settings.tsx
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, {
useState,
forwardRef,
useImperativeHandle,
createRef,
File ExamplePeek.tsx
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useEffect, useState, useReducer } from "react";
import Plot from "react-plotly.js";
type Location = {
location: string;
File Container.tsx
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useState, useEffect, useRef, createRef } from "react";
import { Transition } from "../components/lib/Transition";
import { useWindowKey } from "../hooks/useWindowKey";
import { classNames } from "../utils/classNames";
import { useMouseOutside } from "../hooks/useMouseOutside";
Function Accounts
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Accounts: FC<{}> = ({}) => {
const { url } = useRouteMatch();
const { state: { autoSelect } = { autoSelect: false } } = useLocation();
const { loading, error, data } = useQuery(ACCOUNTS_QUERY);
Function handleRequest
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const handleRequest = async (request: Request) => {
const data = await request.formData();
const socketID = data.get("socket_id").toString();
const channelName = data.get("channel_name").toString();
Function handleRequest
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const handleRequest = async (request: Request): Promise<Response> => {
let graphQLRequest: GraphQLRequest;
try {
switch (request.method.toLowerCase()) {
Function Cell
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
}> = ({ path, state: { data }, dispatch, value }) => {
let hint;
let disabled = false;
const type = typeof value;
if (["string", "number", "bigint"].includes(type)) return value;
- 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 Table
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
}> = ({ state, dispatch, header = (accessor) => accessor }) => {
const { data, isArray } = useMemo(() => {
const { pathStack, data } = state;
const path = last(pathStack);
const currentData = path ? get(data, path) : data;
- 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
Open
return (
<div>
<a
href="#"
className={classNames(