Showing 137 of 185 total issues
Function filter
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public filter(predicate: Predicate): Node {
const [cloned] = clone([this])
const queue: Node[] = [cloned]
const flatten: Node[] = []
Function fetchColors
has 29 lines of code (exceeds 25 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)
Function logout
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async logout(): Promise<boolean> {
let logoutResult
const tokenType = await Storage.get(STORAGE_KEY.TOKEN_TYPE)
if (tokenType === TOKEN_TYPE.WEB) {
Function Sync
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Sync(): JSX.Element {
const analytics = useAnalytics()
const [mode] = useMode()
const [_, setVisible] = useModal(MODAL.SYNC)
const [hoverRef, isHovered] = useHover(200)
Function Alarm
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Alarm(): JSX.Element {
const [mode] = useMode()
const [_, setVisible] = useModal(MODAL.ALARM)
const analytics = useAnalytics()
const [hoverRef, isHovered] = useHover(200)
Function handleKeyboard
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleKeyboard(e: KeyboardEvent) {
switch (e.key) {
case 'Enter':
case ' ':
if (!menuController.openSubmenu()) hide();
Function parseStr
has a Cognitive Complexity of 10 (exceeds 5 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/ },
- 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 toString
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public toString(): string {
let str = `- [ ] ${this.title}`
// state
if (this.isComplete()) {
str = str.replace('[ ]', '[x]')
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function getProjection(
items: FlattenedItem[],
activeId: UniqueIdentifier,
overId: UniqueIdentifier,
dragOffset: number,
- 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 SyncModal
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function SyncModal(): JSX.Element {
const manager = useTaskManager()
const analytics = useAnalytics()
const isLoggedIn = useOauthState()
const [visible, setVisible] = useModal(MODAL.SYNC)
- 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 Debug
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Debug(): JSX.Element {
const { trackings } = useTrackingState()
const [sCalendar] = useStorage<EventLine[]>(STORAGE_KEY.CALENDAR_EVENT)
const [sAlarms] = useStorage(STORAGE_KEY.ALARMS)
const root = useTaskManager().getRoot()
Function changeIndent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const changeIndent = (
depth: number,
from: number,
to: number,
): [string, number, number] => {
Function stopTracking
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
(node: Node, checked?: boolean) => {
// Clone the objects for updating.
const newNode = node.clone()
const newTask = newNode.data as Task
Function setAlarm
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
setAlarm(param: Alarm, sendResponse: () => void) {
const alarm = new Alarm({
type: param.type,
name: param.name,
message: param.message,
Function fetchCalendars
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function fetchCalendars(): Promise<Calendar[]> {
const url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList'
let p = new URLSearchParams()
p.append('minAccessRole', 'writer')
Function stopTrackings
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const stopTrackings = (
root: Node,
trackings: TrackingState[],
): [Node, CalendarEvent[]] => {
const events = []
Function fetchWrapper
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function fetchWrapper(
url,
option?: FetchOption,
retryCount = 0,
): Promise<any> {
Function ColorPicker
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ColorPicker = (props: Props): JSX.Element => {
const [visible, setVisible] = useState(false)
let presets = unique(props.presetColors) || []
if (presets.length < PresetMax) {
presets = unique(presets.concat(PresetColors))
Function Remain
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Remain(props: RemainProps): JSX.Element {
const estimatedTime = props.estimatedTime
const [time, setTime] = useState<Time>(new Time())
useLayoutEffect(() => {
Function Inner
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Inner(props: EventListProps): JSX.Element {
const { data } = fetchEvents(props.calendar)
const isExist = data.length !== 0
useEffect(() => {