exercism/website

View on GitHub

Showing 287 of 1,075 total issues

Function isLookbehindSupported has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function isLookbehindSupported(): boolean {
  const parser = new UAParser().getBrowser()

  switch (parser.name) {
    case 'IE':
Severity: Minor
Found in app/javascript/utils/regex-check.ts - About 1 hr to fix

    Function useChart has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const useChart = (
      canvas: HTMLCanvasElement | null,
      reputation: number[],
      trackColor?: string
    ): Chart<'radar'> => {

      Function TrackCard has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method flash_messages has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def flash_messages(object = nil, html_messages: false)
            tags = []
            a = alert
            n = notice
        
        
        Severity: Minor
        Found in app/helpers/flash_helper.rb - 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

        Method generic_nav has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def generic_nav(nav_title, submenu: nil, view: nil, path: nil, offset: 0, has_view: false, css_class: nil)
                tag.li class: "nav-element #{css_class}" do
                  content = conditional_link(path) do
                    tag.span(nav_title, tabindex: path.nil? ? 0 : -1, role: 'none',
                      class: "nav-element-label #{path.nil? ? 'nav-element-focusable' : ''}")
        Severity: Minor
        Found in app/helpers/view_components/nav_helpers/generic_nav_helper.rb - 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

        Method contains_cycle? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.contains_cycle?(adjacencies)
            visited = Array.new(adjacencies.length).fill(false)
            on_stack = Array.new(adjacencies.length).fill(false)
            stack = []
        
        
        Severity: Minor
        Found in lib/graph_utils.rb - 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

        Method time_ago_in_words has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def time_ago_in_words(time, short: false)
            t = "#{super(time)}" # rubocop:disable Style/RedundantInterpolation Required to unfreeze string
            t.gsub!(/^about /, '')
            t.gsub!(/^almost /, '')
        
        
        Severity: Minor
        Found in app/helpers/time_helper.rb - 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

        Method call has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def call
            raise "Block must be given for sending" unless block_given?
        
            # We start by doing checks to see if we should send based
            # on the state of the emailable. We hope to catch things
        Severity: Minor
        Found in app/commands/user/send_email.rb - 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 StudentTooltip has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        >(({ endpoint, ...props }, ref) => {
          const { data, error, status } = useRequestQuery<{ student: Student }>(
            [endpoint],
            { endpoint: endpoint, options: {} }
          )
        Severity: Minor
        Found in app/javascript/components/tooltips/StudentTooltip.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 TrackMenu has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function TrackMenu({
          track,
          links,
          ariaHideApp = false,
        }: {
        Severity: Minor
        Found in app/javascript/components/dropdowns/TrackMenu.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

        Method categories_data has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def categories_data(track_id = 0)
            metrics = {
              publishing: publishing_metrics(track_id),
              mentoring: mentoring_metrics(track_id),
              authoring: authoring_metrics(track_id),
        Severity: Minor
        Found in app/assemblers/assemble_contributions_summary.rb - About 1 hr to fix

          Function useList has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function useList(initialRequest: Request): {
            request: ListState
            setCriteria: (criteria: string) => void
            setOrder: (order: string) => void
            setPage: (page: number, key?: string) => void
          Severity: Minor
          Found in app/javascript/hooks/use-list.ts - About 1 hr to fix

            Function computePathProperties has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function computePathProperties(
              pathStartElement: HTMLElement,
              pathEndElement: HTMLElement
            ): ConceptPathProperties {
              const course = getPathCourse(pathStartElement, pathEndElement)
            Severity: Minor
            Found in app/javascript/components/concept-map/helpers/path-helpers.ts - About 1 hr to fix

              Function Button has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Button = (props: Props & { className?: string }) => {
                switch (props.status) {
                  case 'locked':
                    return props.editorEnabled ? (
                      <div className={props.className}>Open in editor</div>
              Severity: Minor
              Found in app/javascript/components/student/OpenEditorButton.tsx - About 1 hr to fix

                Function onGoogleTranslateDetected has 41 lines of code (exceeds 25 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
                Severity: Minor
                Found in app/javascript/utils/react-bootloader.tsx - About 1 hr to fix

                  Function smoothDataPoints has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const smoothDataPoints = (
                    dataPoints: DataPoint[],
                    height: number
                  ): DataPoint[] => {
                    return dataPoints.reduce(
                  Severity: Minor
                  Found in app/javascript/components/common/svg-graph-util.ts - 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 ExerciseCompletedModal has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const ExerciseCompletedModal = ({
                    open,
                    completion,
                    ...props
                  }: {

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

                  function reducer(state: State, action: Action): State {
                    switch (action.type) {
                      case 'avatar.uploaded':
                        return {
                          imageToCrop: null,
                  Severity: Minor
                  Found in app/javascript/components/profile/avatar-selector/use-image-crop.ts - About 1 hr to fix

                    Function Steps has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function Steps() {
                      const { send, currentState } = useContext(TrackContext)
                    
                      switch (currentState.value as StateValue) {
                        case 'hasLearningMode':

                      Method git_filepath has 37 lines of code (exceeds 25 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 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language