exercism/website

View on GitHub

Showing 287 of 1,075 total issues

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

  def call
    {
      id: solution.id,
      last_iterated_at: solution.last_iterated_at,
      published_at: solution.published_at,
Severity: Minor
Found in app/commands/solution/create_search_index_document.rb - About 1 hr to fix

    Function useTheme has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function useTheme(
      defaultThemePreference: string,
      links: Pick<ThemePreferenceLinks, 'update'>
    ): useThemeReturns {
      const [hasBeenUpdated, setHasBeenUpdated] = useState(false)

      Method show has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def show
          begin
            solution = Solution.find_by!(uuid: params[:solution_id])
          rescue ActiveRecord::RecordNotFound
            return render_solution_not_found
      Severity: Minor
      Found in app/controllers/api/v1/files_controller.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 SplitPane has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export const SplitPane = ({
        id,
        left,
        right,
        className = '',
      Severity: Minor
      Found in app/javascript/components/common/SplitPane.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 useDropdown has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export const useDropdown = (
        itemLength: number,
        onItemSelect?: (index: number) => void,
        panelOptions?: any
      ): DropdownAttributes => {
      Severity: Minor
      Found in app/javascript/components/dropdowns/useDropdown.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 TestRunSummaryContent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      const TestRunSummaryContent = ({
        testRun,
        testRunner,
        onSubmit,
        isSubmitDisabled,
      Severity: Minor
      Found in app/javascript/components/editor/TestRunSummary.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 useItemList has a Cognitive Complexity of 12 (exceeds 5 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) => {
      Severity: Minor
      Found in app/javascript/components/common/use-item-list.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 call has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def call
          return if iteration.blank?
          return deleted_version if iteration.deleted?
      
          {
      Severity: Minor
      Found in app/serializers/serialize_iteration.rb - About 1 hr to fix

        Function handleItemKeyDown has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const handleItemKeyDown = (e: React.KeyboardEvent, index: number) => {
            switch (e.key) {
              case 'ArrowDown':
                e.preventDefault()
                setFocusIndex((index + itemLength + 1) % itemLength)
        Severity: Minor
        Found in app/javascript/components/dropdowns/useDropdown.tsx - About 1 hr to fix

          Method track has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def track
              track = Track.find(params[:track_id])
              pages = []
              pages << [track_url(track), track.updated_at, :monthly, 0.9]
              pages << [track_concepts_url(track), track.updated_at, :monthly, 0.85] if track.course?
          Severity: Minor
          Found in app/controllers/sitemaps_controller.rb - About 1 hr to fix

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

              def call
                {
                  uuid: solution.uuid,
                  snippet: solution.snippet,
                  num_views: solution.num_views,
            Severity: Minor
            Found in app/serializers/serialize_community_solution.rb - About 1 hr to fix

              Function reducer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const reducer: Reducer<ListState, ListAction> = (
                state: ListState,
                action: ListAction
              ) => {
                switch (action.type) {
              Severity: Minor
              Found in app/javascript/hooks/use-list.ts - About 1 hr to fix

                Method to_s has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def to_s
                        super("community-solutions-comments-list", {
                          user_signed_in: current_user.present?,
                          allow_comments: solution.allow_comments,
                          is_author: current_user == solution.user,
                Severity: Minor
                Found in app/helpers/react_components/community_solutions/comments_list.rb - About 1 hr to fix

                  Method learning_tracks_data has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def learning_tracks_data
                      user.user_tracks.includes(:track).map do |user_track|
                        track = user_track.track
                  
                        first_completion = user_track.exercise_completion_dates.min
                  Severity: Minor
                  Found in app/assemblers/assemble_journey_overview.rb - About 1 hr to fix

                    Function initEventListeners has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function initEventListeners() {
                      // As we have conditional stylesheets per page, we need to extract and
                      // render those when the frame changes. We want the CSS to load BEFORE
                      // then HTML renders, so we get any stylesheets downloaded and THEN render
                      // continnue processing the frame render.
                    Severity: Minor
                    Found in app/javascript/utils/react-bootloader.tsx - About 1 hr to fix

                      Function useMentoringRequest has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function useMentoringRequest(
                        links: { createMentorRequest: string },
                        onSuccess: (mentorRequest: MentorSessionRequest) => void
                      ): {
                        handleSubmit: (e: React.FormEvent<HTMLFormElement>) => void

                        Function ResultsZone has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const ResultsZone = (
                          props: React.PropsWithChildren<{
                            isFetching: boolean
                            className?: string | null
                          }>
                        Severity: Minor
                        Found in app/javascript/components/ResultsZone.tsx - About 1 hr to fix

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

                            def call
                              # Sometimes the iteration might be deleted
                              # before we get to the job. There *shouldn't* be
                              # a DB race condition because of the way this is called
                              # in Iteration::Create but if we see missing snippets,
                          Severity: Minor
                          Found in app/commands/iteration/generate_snippet.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 useStripeForm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function useStripeForm({
                            captchaRequired,
                            paymentIntentType,
                            amount,
                            confirmParamsReturnUrl,
                          Severity: Minor
                          Found in app/javascript/components/donations/stripe-form/useStripeForm.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

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

                            def call
                              source_submission_hash = solution_files_hash(representation.source_submission)
                              example_submissions = { source_submission_hash => representation.source_submission }
                          
                              MAX_PAGES_FETCHED.times do |page|
                          Severity: Minor
                          Found in app/commands/exercise/representation/find_example_submissions.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

                          Severity
                          Category
                          Status
                          Source
                          Language