Showing 137 of 185 total issues
Function CalendarListInner
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function CalendarListInner(props: CalendarListProps): JSX.Element {
const [calendar, setCalendar] = useStorage<Calendar>(props.calendarKey)
const resApi = fetchCalendars()
const needReAuth = resApi.data == null
Function useAlarms
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useAlarms(): useAlarmsReturn {
const [alarms, _setAlarms] = useRecoilState<Alarm[]>(alarmState)
const [alarmRules] = useStorage<AlarmRule[]>(STORAGE_KEY.ALARMS)
const setAlarms = useCallback(
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()
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
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
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
Function useHover
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useHover(wait = 0 /* ms */): useHoverReturn {
const [hovered, setHovered] = useState(false)
const [isHovered, setIsHovered] = useState(false)
const [timeoutID, setTimeoutID] = useState<number>()
const hoverRef = useRef<HTMLElement>(null)
Function Submenu
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const Submenu: React.FC<SubMenuProps> = ({
arrow,
children,
disabled = false,
hidden = 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 PieChart
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function PieChart(props: Props): JSX.Element {
const options = {
animation: {
duration: 0,
},