Showing 137 of 185 total issues
Function taskToAlarms
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
taskToAlarms: (task: Task, alarmRules: AlarmRule[]): Alarm[] => {
return alarmRules
.map((rule) => {
let minutes = 0
let message: string
Function fetchWrapper
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export async function fetchWrapper(
url,
option?: FetchOption,
retryCount = 0,
): Promise<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 getProjection
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getProjection(
items: FlattenedItem[],
activeId: UniqueIdentifier,
overId: UniqueIdentifier,
dragOffset: number,
Function ColorPicker
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ColorPicker = (props: ColorPickerProps): JSX.Element => {
const colors = props.colors
const click = (e) => {
const id = e.target.value
Function startTrackingForCalendarEvent
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const startTrackingForCalendarEvent = async (eventId: string) => {
const trackings = (await Storage.get(
STORAGE_KEY.TRACKING_STATE,
)) as TrackingState[]
const eventLines = (await Storage.get(
Function useTagHistory
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useTagHistory(): useTagHistoryReturn {
const [tags, setTags] = useRecoilState(tagRecordState)
const upsertTag = useCallback(
(record: TagRecord) => {
Function ReportSummary
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ReportSummary(props: ReportSummaryProps): JSX.Element {
const [mode, setMode] = useMode()
const manager = useTaskManager()
const root = manager.getRoot()
const analytics = useAnalytics()
Function Tooltip
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Tooltip(props: TooltipProp): JSX.Element {
const [popperElement, setPopperElement] = useState(null)
const [arrowElement, setArrowElement] = useState(null)
const { styles, attributes } = usePopper(props.refElm, popperElement, {
placement: props.location,
Function gdTable
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
...groups.reduce<string[][]>((acc, group) => {
const tasks = nodeToTasks(group, onlyCompleted)
const gt = aggregate(tasks)
const g = group.data as Group
Function fetchEvents
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async function fetchEvents(calendar: Calendar): Promise<CalendarEvent[]> {
if (!calendar) return []
const calendarId = calendar.id
const timeZone = calendar.timeZone
const url = `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events`
- 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 selectRecord
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function selectRecord(
key: TaskRecordKey,
records: TaskRecordArray,
): Node {
if (key.keyType === KEY_TYPE.SINGLE) {
- 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 useEventAlarm
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function useEventAlarm(): useEventAlarmReturn {
const [eventLines, setEventLines] = useStorage<EventLine[]>(
STORAGE_KEY.CALENDAR_EVENT,
)
const { stopAlarms } = useAlarms()
- 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 insertEvent
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function insertEvent(
calendar: Calendar,
event: CalendarEvent,
): Promise<boolean> {
const calendarId = calendar.id
Function useTaskStorage
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useTaskStorage(): void {
const { addTimes } = useTimeHistory()
const [records, setRecords] = useRecoilState(allRecordsState)
const key = useRecoilValue(taskRecordKeyState)
const root = useRecoilValue(nodeState)
Function TagMenu
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function TagMenu(props: TagMenuProps): JSX.Element {
const [pickerVisible, setPickerVisible] = useState(false)
const [refElm, setRefElm] = useState(null)
const analytics = useAnalytics()
Function SyncButton
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function SyncButton(param: SyncButtonParam): JSX.Element {
const [sync, setSync] = useState(false)
const [completed, setCompleted] = useState(false)
const onClick = async () => {
Function treeItemsToNode
has 30 lines of code (exceeds 25 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
Function ReportTable
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ReportTable(props: Props): JSX.Element {
const header = props.table[0]
const table = props.table.slice(1).map((row) => {
const key = cell2str(row[0])
return [key, ...row]
Function TaskTags
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function TaskTags(props: Props): JSX.Element {
const [hoverRef, isHovered] = useHover(200)
const tags = props.tags.slice(0, TagCountMax)
const isOmit = props.tags.length > TagCountMax
const omitCount = props.tags.length - TagCountMax
Function TaskTag
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const TaskTag = (props: Props): JSX.Element => {
const tag = props.tag
const [pickerVisible, setPickerVisible] = useState(false)
const refElm = useRef<Element>(null)
const { tags, upsertTag } = useTagHistory()