exercism/website

View on GitHub

Showing 274 of 1,062 total issues

File types.ts has 831 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Props as ConceptWidgetProps } from './common/ConceptWidget'
import { Props as ExerciseWidgetProps } from './common/ExerciseWidget'
import { Flair } from './common/HandleWithFlair'
import { DiscussionPostProps } from './mentoring/discussion/DiscussionPost'
import { Scratchpad } from './mentoring/Session'
Severity: Major
Found in app/javascript/components/types.ts - About 1 day to fix

    File application.tsx has 759 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable @typescript-eslint/no-explicit-any */
    import React, { lazy, Suspense } from 'react'
    import { camelizeKeys } from 'humps'
    import { camelizeKeysAs } from '@/utils/camelize-keys-as'
    import { initReact } from '@/utils/react-bootloader'
    Severity: Major
    Found in app/javascript/packs/application.tsx - About 1 day to fix

      Function loadLanguageCompartment has 252 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const loadLanguageCompartment = async (
        language: string
      ): Promise<Extension> => {
        switch (language) {
          case 'cpp': {
      Severity: Major
      Found in app/javascript/components/misc/CodeMirror/languageCompartment.ts - About 1 day to fix

        File internal.tsx has 578 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* eslint-disable @typescript-eslint/no-explicit-any */
        // Absolute, module imports
        import React, { Suspense, lazy } from 'react'
        import { camelizeKeys } from 'humps'
        import currency from 'currency.js'
        Severity: Major
        Found in app/javascript/packs/internal.tsx - About 1 day to fix

          mappings has 66 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export const mappings = {
            'share-link': (data: any): JSX.Element => (
              <Suspense fallback={RenderLoader()}>
                <ShareLink
                  title={data.title}
          Severity: Major
          Found in app/javascript/packs/application.tsx - About 1 day to fix

            Function Session has 208 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function Session(props: SessionProps): JSX.Element {
              const [session, setSession] = useState(props)
              const {
                student,
                track,
            Severity: Major
            Found in app/javascript/components/mentoring/Session.tsx - About 1 day to fix

              `` has 47 functions (exceeds 20 allowed). Consider refactoring.
              Open

              initReact({
                'common-markdown-editor': (data: any) => (
                  <Suspense fallback={RenderLoader()}>
                    <MarkdownEditor contextId={data.context_id} />
                  </Suspense>
              Severity: Minor
              Found in app/javascript/packs/internal.tsx - About 6 hrs to fix

                File tailwind.config.js has 386 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module.exports = {
                  mode: 'jit',
                  options: {
                    // The following extractor is the same as the default of v2, except it includes cut off points for semicolons.
                    defaultExtractor: (line) => {
                Severity: Minor
                Found in tailwind.config.js - About 5 hrs to fix

                  Function useDropdown has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const useDropdown = (
                    itemLength: number,
                    onItemSelect?: (index: number) => void,
                    panelOptions?: any
                  ): DropdownAttributes => {
                  Severity: Major
                  Found in app/javascript/components/dropdowns/useDropdown.tsx - About 4 hrs to fix

                    Function exports has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    module.exports = function (api) {
                      var validEnv = ['development', 'test', 'production']
                      var currentEnv = api.env()
                      var isDevelopmentEnv = api.env('development')
                      var isProductionEnv = api.env('production')
                    Severity: Major
                    Found in babel.config.js - About 3 hrs to fix

                      Function Info has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const Info = ({
                        exercise,
                        track,
                        solution,
                        renderBlurb,
                      Severity: Minor
                      Found in app/javascript/components/common/exercise-widget/Info.tsx - About 3 hrs 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 createChartConfig has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function createChartConfig(
                        data: number[],
                        labels: string[],
                        milestones: Milestone[],
                        dateMap: { [key: string]: number }
                      Severity: Major
                      Found in app/javascript/components/impact/chart-elements/chart-config.ts - About 3 hrs to fix

                        Method impact has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def impact
                            # This is the calculation for the average first iteration time.
                            # It comes out at 2594 (seconds) at the time of writing
                            #
                            # SELECT AVG(dd.val) as median_val
                        Severity: Major
                        Found in app/controllers/about_controller.rb - About 3 hrs to fix

                          Method git_filepath has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def git_filepath(field, file:, append_file: nil)
                                if file.instance_of?(Proc)
                                  read_method = "read_text_blob"
                                else
                                  json_file = file.end_with?('.json')
                          Severity: Minor
                          Found in app/models/git/has_git_filepath.rb - About 3 hrs 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

                          Class NotificationsMailer has 27 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class NotificationsMailer < ApplicationMailer
                            def mentor_started_discussion
                              notification = params[:notification]
                              @user = notification.user
                              @discussion = notification.discussion
                          Severity: Minor
                          Found in app/mailers/notifications_mailer.rb - About 3 hrs to fix

                            File Session.tsx has 295 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import React, {
                              useState,
                              createContext,
                              useCallback,
                              useEffect,
                            Severity: Minor
                            Found in app/javascript/components/mentoring/Session.tsx - About 3 hrs to fix

                              Function Header has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export const Header = ({
                                iteration,
                                exercise,
                                links,
                              }: {
                              Severity: Minor
                              Found in app/javascript/components/student/solution-summary/Header.tsx - About 2 hrs 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 useSubmissionsList has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const useSubmissionsList = (
                                defaultList: readonly Submission[],
                                links: Links
                              ): {
                                current: Submission | null
                              Severity: Major
                              Found in app/javascript/components/editor/useSubmissionsList.ts - About 2 hrs to fix

                                Function smoothDataPoints has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const smoothDataPoints = (
                                  dataPoints: DataPoint[],
                                  height: number
                                ): DataPoint[] => {
                                  return dataPoints.reduce(
                                Severity: Major
                                Found in app/javascript/components/common/svg-graph-util.ts - About 2 hrs to fix

                                  Function drawCustomTooltip has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function drawCustomTooltip(
                                    ctx: CanvasRenderingContext2D,
                                    options: CustomTooltipOptions
                                  ) {
                                    const {
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language