Showing 287 of 1,075 total issues
Function drawCustomTooltip
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawCustomTooltip(
ctx: CanvasRenderingContext2D,
options: CustomTooltipOptions
) {
const {
Function annotateLanding
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const annotateLanding = (): void => {
window.addEventListener('load', () => {
const h1 = document.querySelector<HTMLElement>('#page-landing h1 strong')
if (h1) {
Function useThemeObserver
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useThemeObserver(updateEndpoint?: string): ThemeData {
const [isDarkMode, setIsDarkMode] = useState(
window.matchMedia('(prefers-color-scheme: dark)').matches
)
const [themeData, setThemeData] = useState<ThemeData>({
Function timeout
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
const timeout = setTimeout(() => {
const containerHeight = (canvas.parentNode as HTMLElement).offsetHeight
const point0 = chart.getDatasetMeta(0).iScale.getPointLabelPosition(0)
const label0 = labelRefs.current[0].current
Function lazyHighlightAll
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export function lazyHighlightAll(): void {
if (!isLookbehindSupported()) return
function applySyntaxHighlighting() {
import('@/utils/highlight')
.then((m) => {
- 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 Form
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export const Form = ({
request,
defaultAmount,
defaultTransactionType,
onSuccess,
- 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
File TestRunSummary.tsx
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react'
import { TestRun, TestRunner, TestRunStatus, TestStatus } from './types'
import { TestRunSummaryByStatusHeaderMessage } from './TestRunSummaryByStatusHeaderMessage'
import { TestRunOutput } from './TestRunOutput'
import { SubmitButton } from './SubmitButton'
Function usePanel
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function usePanel(options?: any) {
let modifiers = [
{
name: 'offset',
options: {
File languageCompartment.ts
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { StreamLanguage } from '@codemirror/language'
import { Compartment, Extension } from '@codemirror/state'
const compartment = new Compartment()
Function useLockedSolutionMentoringNote
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useLockedSolutionMentoringNote(
request: MentorSessionRequest
): useLockedSolutionMentoringNoteReturns {
const [lockedUntil, setLockedUntil] = useState(dayjs(request.lockedUntil))
const [diff, setDiff] = useState(lockedUntil.diff(dayjs(), 'minute'))
Function onGoogleTranslateDetected
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function onGoogleTranslateDetected(): void {
// See: https://github.com/facebook/react/issues/11538#issuecomment-417504600
if (typeof Node === 'function' && Node.prototype) {
const originalRemoveChild: (child: Node) => Node =
Node.prototype.removeChild
- 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 Component
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const Component = ({ exercises, value, setValue }: Props): JSX.Element => {
const [searchQuery, setSearchQuery] = useState('')
const [isShowingExercisesToMentor, setIsShowingExercisesToMentor] =
useState(true)
const [isShowingExercisesCompleted, setIsShowingExercisesCompleted] =
- 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 useTrackWelcomeModal
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function useTrackWelcomeModal(links: TrackWelcomeModalLinks) {
const [open, setOpen] = useState(true)
const {
mutate: hideModal,
status,
Function handleNavbarFocus
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function handleNavbarFocus(): void {
const navElements = document.querySelectorAll<HTMLElement>(
'.nav-element-focusable'
)
let currentMouseOverElement: HTMLElement | null = null
Function tooltipReducer
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const tooltipReducer: ShowReducer = function (state, body) {
const { id, action } = body
const nextState: TooltipState = { ...state }
// Use action to update the next state
Function usePostHighlighting
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const usePostHighlighting = (
posts: DiscussionPostProps[],
userHandle: string
) => {
const prevLastPost = useRef<DiscussionPostProps | null>(null)
File notifications_mailer.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
class NotificationsMailer < ApplicationMailer
def mentor_started_discussion
notification = params[:notification]
@user = notification.user
@discussion = notification.discussion
Function editorOptions
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
const editorOptions = useMemo<SimpleMDEReactProps['options']>(() => {
return {
autosave: contextId
? { enabled: true, uniqueId: contextId, delay: 1000 }
: undefined,
Function useItemList
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useItemList = <T extends ListItemType>(cacheKey: QueryKey) => {
const queryClient = useQueryClient()
const [editingItem, setEditingItem] = useState<T | null>(null)
const handleEdit = useCallback((item) => {
Function MarkdownEditorForm
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const MarkdownEditorForm = ({
expanded,
onSubmit,
onClick = () => null,
onCancel,
- 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"