Showing 185 of 185 total issues
Function Report
has 306 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Report(): JSX.Element {
const [report, setReport] = useRecoilState(reportState)
const [onlyCompleted, setOnlyCompleted] = useState(true)
const { tags } = useTagHistory()
const manager = useTaskManager()
Function TodoEditor
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
export function TodoEditor(): JSX.Element {
const manager = useTaskManager()
const rootText = manager.getText()
const [saving] = useStorageWatcher()
const [text, setText] = useState('')
- 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 SortableTree
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
export function SortableTree({
collapsible,
indicator = false,
indentationWidth = 20,
removable,
- 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 TodoEditor
has 207 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function TodoEditor(): JSX.Element {
const manager = useTaskManager()
const rootText = manager.getText()
const [saving] = useStorageWatcher()
const [text, setText] = useState('')
Function sortableTreeKeyboardCoordinates
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
(context, indicator, indentationWidth) =>
(
event,
{
currentCoordinates,
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
<section>
<h2 className="py-6 mt-5 text-base font-bold">
{i18n.t('total_by_tags')}
</h2>
{isTagExists ? (
- 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 184.
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
<section>
<h2 className="py-6 mt-5 text-base font-bold">
{i18n.t('total_by_groups')}
</h2>
{isGroupExists ? (
- 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 184.
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 SyncModal
has 163 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function SyncModal(): JSX.Element {
const manager = useTaskManager()
const analytics = useAnalytics()
const isLoggedIn = useOauthState()
const [visible, setVisible] = useModal(MODAL.SYNC)
Similar blocks of code found in 2 locations. Consider refactoring. Open
return (
<button
className={classnames('icon-button group mod--sync', {
hidden: !isVisible,
})}
- 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 161.
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
return (
<button
className={classnames('icon-button group mod--alarm', {
hidden: !isVisible,
})}
- 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 161.
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 createKeyboardController
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
export function createKeyboardController() {
const menuList = new Map<HTMLElement, Menu>();
let focusedIndex: number;
let parentNode: HTMLElement;
let isRoot: boolean;
- 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 Report.tsx
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useState } from 'react'
import { atom, useRecoilState } from 'recoil'
import { color } from 'd3-color'
import { Checkbox } from '@/components/Checkbox'
Function Autocomplete
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
(props: AutocompleteProps, ref: React.RefObject<HTMLDivElement>) => {
const { tags } = useTagHistory()
const { times } = useTimeHistory()
const [cursor, setCursor] = useState(CURSOR_NONE)
const tokenPosition = useRef(0)
Function TaskItem
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const TaskItem: React.FC<TaskItemProps> = (
props: TaskItemProps,
): JSX.Element => {
const checkboxProps = props.checkboxProps
const node = props.node
Function TagPicker
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const TagPicker = (props: Props): JSX.Element => {
const [currentTags, setCurrentTags] = useState(props.initialTags)
const [inputTxt, setInputTxt] = useState('')
const [tmpTag, setTmpTag] = useState<string>(null)
const { tags, upsertTag } = useTagHistory()
File SortableTree.tsx
has 341 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useMemo, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import {
Announcements,
DndContext,
Function createKeyboardController
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createKeyboardController() {
const menuList = new Map<HTMLElement, Menu>();
let focusedIndex: number;
let parentNode: HTMLElement;
let isRoot: boolean;
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (this.tags.length > 0) {
const tagStr = this.tags
.map((t) => (t.quantity ? `#${t.name}:${t.quantity}` : `#${t.name}`))
.join(' ')
str += ` ${tagStr}`
- 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 112.
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
if (this.tags.length > 0) {
const tagStr = this.tags
.map((t) => (t.quantity ? `#${t.name}:${t.quantity}` : `#${t.name}`))
.join(' ')
str += ` ${tagStr}`
- 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 112.
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 AlarmEditor
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function AlarmEditor(): JSX.Element {
const [minutes, setMinutes] = useState<number>(0)
const [timing, setTiming] = useState<Timing>({} as Timing)
const [alarms, setAlarms] = useStorage<AlarmRule[]>(STORAGE_KEY.ALARMS)
const analytics = useAnalytics()