Showing 19 of 19 total issues
File sut.ts
has 639 lines of code (exceeds 250 allowed). Consider refactoring. Open
import type {
InitializerArgs,
InitialStep,
StepData,
StepperState,
Similar blocks of code found in 2 locations. Consider refactoring. Open
export class ErrorStoreBuilder {
private readonly errorStoreParameters: ErrorStoreParameters
constructor(
errorStoreParameters: DeepReadonly<ErrorStoreParameters> = {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 396.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
export class TaskStoreBuilder {
private readonly taskStoreParameters: TaskStoreParameters
constructor(
taskStoreParameters: DeepReadonly<TaskStoreParameters> = {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 396.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function Select
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
export const Select = ({
placeholder,
size = 'medium',
disabled = false,
hasError = false,
- 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 Faucet
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export const Faucet: React.FC<FaucetProps> = ({ chainId, captcha }: DeepReadonly<FaucetProps>) => {
const [initiator, setInitiator]: UseState<Initiator> = useState<Initiator>(null)
const [walletRecaptcha, setWalletRecaptcha]: UseState<boolean> = useState<boolean>(false)
const [addressRecaptcha, setAddressRecaptcha]: UseState<boolean> = useState<boolean>(false)
const faucetDispatch = useFaucetDispatch()
- 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 stepperReducer
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const stepperReducer = (
state: DeepReadonly<StepperState>,
action: DeepReadonly<StepperAction>
): DeepReadonly<StepperState> => {
switch (action.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
File Faucet.tsx
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useCallback, useMemo, useState } from 'react'
import keplrImage from 'assets/images/keplr.png'
import { acknowledgeError } from 'domain/error/usecase/acknowledge-error/acknowledgeError'
import type { AppState as FaucetAppState } from 'domain/faucet/store/appState'
import type { AppState as TaskAppState } from 'domain/task/store/appState'
Function registerTask
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
(registerTaskPayload: DeepReadonly<RegisterTask>): ThunkResult<Promise<void>> =>
// eslint-disable-next-line @typescript-eslint/typedef
async (dispatch, getState) => {
const {
id,
- 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 Stepper
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const Stepper: React.FC<StepperProps> = ({
steps,
activeStepId,
isSubmitDisabled,
submitButtonLabel,
- 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 uploadFiles
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
(uploadFilesPayload: DeepReadonly<UploadFiles>): ThunkResult<Promise<void>> =>
// eslint-disable-next-line @typescript-eslint/typedef
async (dispatch, getState, { fileRegistryGateway }) => {
try {
const storeParams: StoreParams = { state: getState(), dispatch }
- 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 isProgressValid
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const isProgressValid = (progress: DeepReadonly<Progress>): boolean => {
const { max, min, current }: Progress = progress
// force undefined explicit assertion to ensure that 0 and negative values are excluded
if (current !== undefined) {
- 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 drawBouncingText
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const drawBouncingText = ({
canvas,
deltaCount
}: {
canvas: HTMLCanvasElement
- 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
Consider simplifying this complex logical expression. Open
if (useInit()) {
const { scene }: WorldTickData = world.latestTickData
const camera = new ArcRotateCamera(
options?.name ?? defaultArcRotateCamera.name,
options?.alpha ?? defaultArcRotateCamera.alpha,
Function FileInput
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const FileInput: React.FC<FileInputProps> = ({
label,
description,
multiple = true,
acceptedFormats,
- 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 configureTaskProgressBounds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
(
configureTaskProgressBoundsPayload: DeepReadonly<ConfigureTaskProgressBounds>
): ThunkResult<Promise<void>> =>
// eslint-disable-next-line @typescript-eslint/typedef
async (dispatch, getState) => {
- 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 {
...state,
...(payloadIsOk && {
steps: state.steps
.map((step: DeepReadonly<StepData>) => ({
Avoid too many return
statements within this function. Open
if (min !== undefined && max !== undefined) return min < max
Avoid too many return
statements within this function. Open
return true
Avoid too many return
statements within this function. Open
return {
...state,
steps: state.steps.set(activeId, { ...activeStep, status: 'completed' })
}