Showing 185 of 185 total issues
Function TagPicker
has a Cognitive Complexity of 15 (exceeds 5 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()
- 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 taskToAlarms
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
taskToAlarms: (task: Task, alarmRules: AlarmRule[]): Alarm[] => {
return alarmRules
.map((rule) => {
let minutes = 0
let message: string
- 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 Inner
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Inner(props: CalendarColorsProps): JSX.Element {
const analytics = useAnalytics()
const [visible, setVisible] = useState(false)
const [refElm, setRefElm] = useState(null)
const [colors, setColors] = useStorage<ColorStorage>(
Function parseStr
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
static parseStr(timeStr: string): Time {
const timeRegexps = [
{ type: TIME_TYPE.NEGATIVE_SIGN, regexp: /^(-)/ },
{ type: TIME_TYPE.MINUTE, regexp: /(\d+)m/ },
{ type: TIME_TYPE.HOUR, regexp: /(\d+(?:\.\d+)?)h/ },
Function importGoogle
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const importGoogle = async () => {
analytics.track('import google calendar')
let eventsFiltered = events.filter(
(e) => e.responseStatus !== RESPONSE_STATUS.DECLINED,
Function TrackingStatus
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function TrackingStatus(): JSX.Element {
const manager = useTaskManager()
const analytics = useAnalytics()
const [mode] = useMode()
const { trackings } = useTrackingState()
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (rule.timing === ALARM_TIMING.BEFORE) {
minutes =
task.estimatedTimes.toMinutes() -
task.actualTimes.toMinutes() -
rule.minutes
- 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 71.
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
} else {
minutes =
task.estimatedTimes.toMinutes() -
task.actualTimes.toMinutes() +
rule.minutes
- 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 71.
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 moveLine
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function moveLine(
current: number,
from: number,
to: number,
length: number,
Function ItemConfirm
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ItemConfirm: React.FC<Props> = (props: Props): JSX.Element => {
const [confirm, setConfirm] = useState(false)
const [event, setEvent] = useState()
const { hideAll } = useContextMenu()
Function Edit
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Edit(): JSX.Element {
const { stopAllTracking } = useTrackingStop()
const analytics = useAnalytics()
const [hoverRef, isHovered] = useHover(200)
const [mode, setMode] = useMode()
Function treeItemsToNode
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export function treeItemsToNode(items: TreeItems): Node {
let parent = new Node(NODE_TYPE.ROOT, 0, null)
let queue: TreeItems = [...items]
// for ROOT
- 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
{time.hours > 0 ? (
<>
<span className="counter__hours">{time.hours}</span>
<span className="counter__unit">h</span>
</>
- 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 70.
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 MyCalendar
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function MyCalendar(props: Props): JSX.Element {
const [visible, setVisible] = useState(false)
const { date, range, setDate, setDateRange } = useCalendarDate()
const { setKey, recordKeys } = useTaskRecordKey()
const analytics = useAnalytics()
- 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
{time.days > 0 ? (
<>
<span className="counter__days">{time.days}</span>
<span className="counter__unit">d</span>
</>
- 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 70.
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 LineEditor
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export function LineEditor(props: Props): JSX.Element {
const line = props.line
const manager = useTaskManager()
const analytics = useAnalytics()
const finishEdit = useEditFinish()
- 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 getMovementAnnouncement
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getMovementAnnouncement(
eventName: string,
activeId: UniqueIdentifier,
overId?: UniqueIdentifier,
) {
Function ButtonGroup
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ButtonGroup(props: ButtonGroupProps): JSX.Element {
const [selected, setSelected] = useState<string>(props.initial)
const [bgLeft, setBgLeft] = useState(0)
const ref = useRef<HTMLButtonElement>()
Function parse
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parse(text: string): Node {
Log.v('start parse')
const root = new Node(NODE_TYPE.ROOT, 0, null)
let parent = root
let prevDepth = 0
Similar blocks of code found in 2 locations. Consider refactoring. Open
default: selector({
key: 'tagRecordStateSelector',
get: async () => {
const records = (await Storage.get(STORAGE_KEY.TASK_TAGS)) as TagRecord[]
if (!records) return []
- 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 67.
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