Showing 17 of 230 total issues
File CreatePost.tsx
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Component, createRef, FormEvent, RefObject } from "react";
import { Mutation } from "@apollo/client/react/components";
import { toast } from "react-toastify";
import { gql } from "@apollo/client";
import { ApolloConsumer } from "@apollo/client";
Function render
has 139 lines of code (exceeds 80 allowed). Consider refactoring. Open
render() {
const { amountError, receiversError, messageError } = this.state;
const { transaction } = this.props;
return (
<ApolloConsumer>
Function render
has 109 lines of code (exceeds 80 allowed). Consider refactoring. Open
render() {
return (
<Mutation<CreateGoalParameters>
mutation={this.state.editing ? UPDATE_GOAL : CREATE_GOAL}
onCompleted={() => {
Function render
has 103 lines of code (exceeds 80 allowed). Consider refactoring. Open
render() {
return (
<Mutation<CreateGuidelineParameters>
mutation={this.state.editing ? UPDATE_GUIDELINE : CREATE_GUIDELINE}
onCompleted={() => {
Function setTestSubject
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const setTestSubject = <
TComponent extends React.FC<any>,
TDecorators extends Decorator<string, any>[],
>(
Component: TComponent,
- 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 render
has 95 lines of code (exceeds 80 allowed). Consider refactoring. Open
render() {
return (
<ApolloConsumer>
{(client) => (
<div className="form-container">
Function KudometerRow
has 91 lines of code (exceeds 80 allowed). Consider refactoring. Open
export function KudometerRow(props: KudometerRowProps) {
function deleteKudometer(mutation: any) {
const { id } = props.kudometer;
if (global.confirm("Are you sure you want to delete this kudometer?")) {
mutation({ variables: { id } });
Function render
has 89 lines of code (exceeds 80 allowed). Consider refactoring. Open
render() {
return (
<Mutation<LoginResult, LoginParameters>
mutation={MUTATION_LOGIN}
onError={(error) => {
Function calculateProgress
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const calculateProgress = (
goals: Goal[],
current: number,
scale = 100,
): number => {
- 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 AlterRoleButton
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function AlterRoleButton(props: AlterRoleButtonProps) {
function isDisabled(): boolean {
if (props.mode === AlterRoleButtonMode.PROMOTE) {
return props.membership.role === "admin";
}
- 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 render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { liked, post } = this.props;
const allLikes = post.votes.length
? post.votes.map((item) => item.voter.name).join(", ")
- 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 InviteList
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const InviteList = () => (
<div>
<Query<InvitesResult>
query={GET_INVITES}
pollInterval={2000}
- 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;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return false;
Function onSubmit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
onSubmit(
e: FormEvent<HTMLFormElement>,
createPost: any,
client: ApolloClient<any>,
) {
- 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 Invite
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function Invite(props: InviteProps) {
const showConfirmDialog = (
deleteInvite: MutationFunction<
DeleteInviteParameters,
OperationVariables,
- 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"