Showing 185 of 185 total issues
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)
Similar blocks of code found in 2 locations. Consider refactoring. Open
default: selector({
key: 'savedTrackingStateList',
get: async () => {
const trackings = (await Storage.get(
STORAGE_KEY.TRACKING_STATE,
- 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 67.
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 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
chrome.storage.local.remove(key, function () {
Log.d('storage remove: ' + key)
if (chrome.runtime.lastError != null) {
reject(chrome.runtime.lastError)
} else {
- 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 66.
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
chrome.storage.local.set({ [key]: value }, function () {
Log.d('storage set: ' + key)
if (chrome.runtime.lastError != null) {
reject(chrome.runtime.lastError)
} else {
- 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 66.
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 PieChart
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function PieChart(props: Props): JSX.Element {
const options = {
animation: {
duration: 0,
},
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,
Similar blocks of code found in 3 locations. Consider refactoring. Open
if (this._hours >= DAY) {
this._days += Math.floor(this._hours / DAY)
this._hours = this._hours % DAY
}
- 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 61.
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 3 locations. Consider refactoring. Open
if (this._minutes >= HOUR) {
this._hours += Math.floor(this._minutes / HOUR)
this._minutes = this._minutes % HOUR
}
- 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 61.
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 3 locations. Consider refactoring. Open
if (this._seconds >= MINUTE) {
this._minutes += Math.floor(this._seconds / MINUTE)
this._seconds = this._seconds % MINUTE
}
- 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 61.
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 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"