Showing 185 of 185 total issues
Time
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
export class Time {
static parseMs(ms: number): Time {
const time = new Time()
if (ms < 0) {
time._isNegative = true
Function MdWrapper
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const MdWrapper: React.FC<Props> = (props: Props): JSX.Element => {
const manager = useTaskManager()
const [_, __, edit] = useEditable(props.line)
const { trackings } = useTrackingState()
const tracking = trackings.find((n) => n.line === props.line)
Function Menu
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function Menu(): JSX.Element {
const [isFixed, setFixed] = useState(false)
const [mode, setMode] = useMode()
const isReport = mode === MODE.REPORT
const analytics = useAnalytics()
Function BasePicker
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const BasePicker = (props: BasePickerProps): JSX.Element => {
const eventType = props.eventType || EVENT_TYPE.CLICK
const [boundaryRef, isBoundaryHovered] = useHover()
const [overlayRef, isOverlayHovered] = useHover()
const [contentRef] = useHoverCancel()
Function TaskItem
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export const TaskItem: React.FC<TaskItemProps> = (
props: TaskItemProps,
): JSX.Element => {
const checkboxProps = props.checkboxProps
const node = props.node
- 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 Item
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export const Item: React.FC<ItemProps> = ({
id,
children,
className,
style,
- 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 useActivity
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useActivity(): useActivityReturn {
const [uploadParam, setUploadParam] = useState<UploadParam>()
const [activities, setActivities] = useStorage<CalendarEvent[]>(
STORAGE_KEY.ACTIVITIES,
)
Function AlarmModal
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function AlarmModal(): JSX.Element {
const analytics = useAnalytics()
const { alarms } = useAlarms()
const [visible, setVisible] = useModal(MODAL.ALARM)
const alarmExists = alarms?.length > 0
Similar blocks of code found in 2 locations. Consider refactoring. Open
<div className="modal-window-header">
<h2>{t('label_alarm')}</h2>
<button
className="modal-window-header__close icon-button"
onClick={onRequestClose}
- 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 79.
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
<Item id="color" onClick={handleInsert}>
<div className="context-menu__color">
<Icon className="context-menu__color-icon" name="plus" />
<span>{t('context_menu_add')}</span>
</div>
- 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 79.
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
<div className="modal-window-header">
<h2>{t('label_google_calendar')}</h2>
<button
className="modal-window-header__close icon-button"
onClick={onRequestClose}
- 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 79.
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
<Item id="color" onClick={handleItemClick}>
<div className="context-menu__color">
<Icon className="context-menu__color-icon" name="palette" />
<span>{t('tag_change_color')}</span>
</div>
- 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 79.
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 Report
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function Report(): JSX.Element {
const [report, setReport] = useRecoilState(reportState)
const [onlyCompleted, setOnlyCompleted] = useState(true)
const { tags } = useTagHistory()
const manager = useTaskManager()
- 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 PlayStopButton
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function PlayStopButton(props: PlayStopProps) {
const { date } = useCalendarDate()
const [tooltipVisible, setTooltipVisible] = useState(false)
const [timeoutID, setTimeoutID] = useState<number>()
const available = props.available && isToday(date)
Function TagButton
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const TagButton = (props: TagButtonProps): JSX.Element => {
const tag = props.tag
const { tags } = useTagHistory()
const tagRecord = tags.find((t) => t.name === tag.name)
const initialBg = tagRecord?.colorHex || COLOR.Gray200
Function fetchEvents
has 51 lines of code (exceeds 25 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`
Function useEventAlarm
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useEventAlarm(): useEventAlarmReturn {
const [eventLines, setEventLines] = useStorage<EventLine[]>(
STORAGE_KEY.CALENDAR_EVENT,
)
const { stopAlarms } = useAlarms()
Function fetchRefreshToken
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetchRefreshToken(): Promise<boolean> {
Log.d('fetchRefreshToken')
return new Promise(async (resolve) => {
const S = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
const state = Array.from(crypto.getRandomValues(new Uint8Array(12)))
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(