exercism/website

View on GitHub

Showing 287 of 1,073 total issues

Function LazyTippy has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const LazyTippy = (props: LazyTippyProps): JSX.Element => {
  const { renderReactComponents, ...tippyProps } = props
  const [mounted, setMounted] = React.useState(false)

  const lazyPlugin = {
Severity: Minor
Found in app/javascript/components/misc/LazyTippy.tsx - About 1 hr to fix

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 IterationSummary has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function IterationSummary({
  iteration,
  className,
  showSubmissionMethod,
  showTestsStatusAsButton,
Severity: Minor
Found in app/javascript/components/track/IterationSummary.tsx - About 1 hr to fix

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 ReferenceElement has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  (
    { exercise, track, solution, renderBlurb, isSkinny, isStatic, ...props },
    ref
  ) => {
    const info = (
Severity: Minor
Found in app/javascript/components/common/ExerciseWidget.tsx - About 1 hr to fix

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 Solution has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const Solution = ({
  privateUrl,
  status,
  publishedIterationHeadTestsStatus,
  numViews,
Severity: Minor
Found in app/javascript/components/journey/Solution.tsx - About 1 hr to fix

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 FileEditorCodeMirror has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function FileEditorCodeMirror({
  language,
  editorDidMount,
  files: defaultFiles,
  settings,
Severity: Minor
Found in app/javascript/components/editor/FileEditorCodeMirror.tsx - About 1 hr to fix

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 useIterationScrolling has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const useIterationScrolling = ({
  iterations,
  setIterations,
  on,
}: {

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 handlePayment has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const handlePayment = async (
    event: React.ChangeEvent<HTMLFormElement>,
    confirmPaymentFn: ConfirmPaymentFn
  ) => {
    event.preventDefault()
Severity: Minor
Found in app/javascript/components/donations/stripe-form/useStripeForm.ts - About 1 hr to fix

    Function lazyHighlightAll has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function lazyHighlightAll(): void {
      if (!isLookbehindSupported()) return
      function applySyntaxHighlighting() {
        import('@/utils/highlight')
          .then((m) => {
    Severity: Minor
    Found in app/javascript/utils/lazy-highlight-all.ts - About 1 hr to fix

      Function useFileRevert has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useFileRevert = () => {
        const { mutate: revertToLastIteration } = useMutation<
          File[],
          unknown,
          Submission
      Severity: Minor
      Found in app/javascript/components/editor/useFileRevert.ts - About 1 hr to fix

        Function SuccessContent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const SuccessContent = () => {
            if (noResults)
              return (
                <div className="--no-results">
                  <GraphicalIcon icon="mentoring" category="graphics" />

          Function build has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function build() {
            const env = require('./.config/env.json')
            require('esbuild')
              .build({
                entryPoints: [
          Severity: Minor
          Found in app/javascript/esbuild.js - About 1 hr to fix

            Method call has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def call
                {
                  uuid: testimonial.uuid,
                  content: testimonial.content,
                  student: {
            Severity: Minor
            Found in app/serializers/serialize_mentor_testimonial.rb - About 1 hr to fix

              Method call has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def call
                  {
                    uuid: solution.uuid,
                    private_url: Exercism::Routes.private_solution_url(solution),
                    public_url: Exercism::Routes.published_solution_url(solution),
              Severity: Minor
              Found in app/serializers/serialize_solution.rb - About 1 hr to fix

                Function useTimeout has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function useTimeout(
                  second: number,
                  callback?: () => void
                ): [
                  React.Dispatch<React.SetStateAction<boolean>>,
                Severity: Minor
                Found in app/javascript/hooks/use-timeout.tsx - About 1 hr to fix

                  Function renderUploadSteps has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function renderUploadSteps() {
                      switch (videoUploadStep) {
                        case 'RETRIEVE':
                          return (
                            <>
                  Severity: Minor
                  Found in app/javascript/components/modals/upload-video/UploadVideoModal.tsx - About 1 hr to fix

                    Function ExerciseCard has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function ExerciseCard() {
                      return (
                        <div className="bg-backgroundColorA shadow-base rounded-8 flex gap-16 py-16 px-24">
                          <Skeleton.Shape shape="circle" style={{ width: 64, height: 64 }} />
                          <div className="flex flex-col w-100">

                      Function generateConfig has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const generateConfig = (
                        canvas: HTMLCanvasElement
                      ): ChartConfiguration<'radar'> => {
                        const borderColor = getComputedStyle(canvas).getPropertyValue(
                          '--chartBorderColor'

                        Method tabs has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def tabs
                                [
                                  link_to(
                                    Exercism::Routes.contributing_root_path,
                                    class: tab_class(:dashboard),
                        Severity: Minor
                        Found in app/helpers/view_components/contributing/header.rb - About 1 hr to fix

                          Function afterDraw has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            afterDraw: (chart: Chart<'line'>): void => {
                              const ctx: CanvasRenderingContext2D = chart.ctx
                              // 0 = index of our dataset, since we only draw one line, this is 0
                              const points = chart.getDatasetMeta(0).data
                              // eslint-disable-next-line @typescript-eslint/ban-ts-comment

                            Function StudentTooltipSkeleton has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function StudentTooltipSkeleton() {
                              return (
                                <Skeleton.Wrapper className="flex flex-col w-[350px]">
                                  <div className="flex flex-row gap-20 mb-16">
                                    <Skeleton.Shape
                              Severity
                              Category
                              Status
                              Source
                              Language