Showing 137 of 185 total issues
Function ensureToken
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async ensureToken(): Promise<string> {
const token = (await Storage.get(STORAGE_KEY.ACCESS_TOKEN)) as string
try {
const response = await fetch(
`https://oauth2.googleapis.com/tokeninfo?access_token=${token}`,
Consider simplifying this complex logical expression. Open
} else if (animation && 'enter' in animation && 'exit' in animation) {
return cx({
[`${CssClass.animationWillEnter}${animation.enter}`]:
animation.enter && visible && !willLeave,
[`${CssClass.animationWillLeave}${animation.exit} ${CssClass.animationWillLeave}'disabled'`]:
Function findItemDeep
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function findItemDeep(
items: TreeItems,
itemId: UniqueIdentifier,
): TreeItem | undefined {
for (const item of items) {
- 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 useMode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function useMode(): ModeReturn {
const [mode, setMode] = useRecoilState(modeState)
const setIsPossibleToSave = useSetRecoilState(isPossibleToSaveState)
const { setKey } = useTaskRecordKey()
const { date, range } = useCalendarDate()
- 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 useTagHistory
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function useTagHistory(): useTagHistoryReturn {
const [tags, setTags] = useRecoilState(tagRecordState)
const upsertTag = useCallback(
(record: TagRecord) => {
- 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 useTrackingState
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function useTrackingState(): useTrackingStateReturn {
const manager = useTaskManager()
const { appendActivities } = useActivity()
const { setAlarmsForTask, stopAlarmsForTask } = useAlarms()
const [trackings, setTrackings] = useRecoilState(trackingStateSelector)
- 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 updateToken
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async updateToken(): Promise<boolean> {
try {
// Remove cached AuthToken if exists.
const tokenType = await Storage.get(STORAGE_KEY.TOKEN_TYPE)
const token = (await Storage.get(STORAGE_KEY.ACCESS_TOKEN)) as 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 MdHeading
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const MdHeading = (props: NodeProps): JSX.Element => {
Log.v(props.node.data)
const manager = useTaskManager()
const [topMargin, setTopMargin] = useState(false)
const line = props.node.line
- 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 getProjection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
items: FlattenedItem[],
activeId: UniqueIdentifier,
overId: UniqueIdentifier,
dragOffset: number,
indentationWidth: number,
Function SyncButton
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function SyncButton(param: SyncButtonParam): JSX.Element {
const [sync, setSync] = useState(false)
const [completed, setCompleted] = useState(false)
const onClick = async () => {
- 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 setComplete
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public setComplete(isComplete: boolean): void {
if (isComplete) {
this.taskState = TASK_STATE.COMPLETE
if (this.actualTimes.isEmpty() && !this.estimatedTimes.isEmpty()) {
- 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 fetchColors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function fetchColors(): Promise<CalendarColor[]> {
const url = 'https://www.googleapis.com/calendar/v3/colors'
let p = new URLSearchParams()
p.append('key', API_KEY)
- 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 to
Avoid too many return
statements within this function. Open
return current + length
Avoid too many return
statements within this function. Open
return newCoordinates
Avoid too many return
statements within this function. Open
return undefined
Avoid too many return
statements within this function. Open
return to + current - from - length + 1
Avoid too many return
statements within this function. Open
return current
Avoid too many return
statements within this function. Open
return to - (length - 1)
Avoid too many return
statements within this function. Open
return to + (current - from)