exercism/website

View on GitHub

Showing 287 of 1,073 total issues

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

export function FauxInputWithValidation(
  inputProps: InputHTMLAttributes<HTMLInputElement> & {
    icon: string
    id: string
    pattern: string

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

    export function UserTooltipSkeleton() {
      return (
        <Skeleton.Wrapper className="flex flex-col w-100">
          <div className="flex flex-row gap-20 mb-16 ">
            <Skeleton.Shape

      Method filter_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def filter_data(requested_category, requested_track_id, data)
          requested_category = requested_category.to_s
          res = data.find do |(track_id, category), _|
            next unless track_id == requested_track_id
            next unless category == requested_category
      Severity: Minor
      Found in app/assemblers/assemble_contributions_summary.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 annotateLanding has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export const annotateLanding = (): void => {
        window.addEventListener('load', () => {
          const h1 = document.querySelector<HTMLElement>('#page-landing h1 strong')
      
          if (h1) {
      Severity: Minor
      Found in app/javascript/utils/annotate-landing.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 fromNow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export function fromNow(date: ConfigType, titleize = false): string {
        const now = dayjs()
        const from = dayjs(date)
      
        const days = now.diff(from, 'day')
      Severity: Minor
      Found in app/javascript/utils/date.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 MarkdownEditor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function MarkdownEditor({
        contextId,
        onChange = () => null,
        editorDidMount,
        url = document.querySelector<HTMLMetaElement>(
      Severity: Minor
      Found in app/javascript/components/common/MarkdownEditor.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 mentoring_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def mentoring_data
          grouped_discussions = user.mentor_discussions.joins(solution: :exercise).group('exercises.track_id').count
          grouped_students = user.mentor_discussions.joins(solution: :exercise).
            group('exercises.track_id').select('solutions.user_id').distinct.count
      
      
      Severity: Minor
      Found in app/assemblers/assemble_journey_overview.rb - About 1 hr to fix

        Function cropImage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function cropImage(
          image: HTMLImageElement,
          crop: CropProps
        ): Promise<Blob | null> {
          if (!crop.width || !crop.height || !crop.x || !crop.y) {

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

            def call
              return unless has_reviews?
              return unless just_closed?
          
              reviewer_usernames = params[:reviews].

            Function ELEMENT_LABELS has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const ELEMENT_LABELS = useMemo(() => {
                const pluralizeNumSubmissions = pluralizeWithNumber.bind(
                  null,
                  representation.numSubmissions
                )

              Function InputWithValidation has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function InputWithValidation(
                inputProps: InputHTMLAttributes<HTMLInputElement> & {
                  id: string
                  pattern: string
                  title: string
              Severity: Minor
              Found in app/javascript/components/settings/inputs/InputWithValidation.tsx - About 1 hr to fix

                Function Concept has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function Concept() {
                  return (
                    <div className="bg-backgroundColorA shadow-baseZ1 padding rounded-8">
                      <Skeleton.Wrapper className="flex flex-col">
                        <div className="py-16 px-24">

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

                    def call
                      user.communication_preferences.update!(
                        email_on_mentor_started_discussion_notification: false,
                        email_on_mentor_replied_to_discussion_notification: false,
                        email_on_student_replied_to_discussion_notification: false,
                  Severity: Minor
                  Found in app/commands/user/unsubscribe_from_all_emails.rb - About 1 hr to fix

                    Function useLazyLoadStripe has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function useLazyLoadStripe(): {
                      stripe: Stripe | null
                      error: string | null
                    } {
                      const [stripe, setStripe] = useState<Stripe | null>(null)

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

                        def call
                          {
                            id: representation.id,
                            exercise: {
                              icon_url: exercise.icon_url,
                      Severity: Minor
                      Found in app/serializers/serialize_exercise_representation.rb - About 1 hr to fix

                        Method create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def create
                            begin
                              submission = Submission.find_by!(uuid: params[:submission_uuid])
                            rescue ActiveRecord::RecordNotFound
                              return render_submission_not_found
                        Severity: Minor
                        Found in app/controllers/api/solutions/submission_ai_help_controller.rb - About 55 mins 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 show has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def show
                            # Save a load of testing headaches
                            if Rails.env.test?
                              return send_data(File.read(Rails.root.join("app", "images", "blank.png")), type: 'image/png', disposition: 'inline')
                            end
                        Severity: Minor
                        Found in app/controllers/avatars_controller.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def call
                            return unless representation
                            return if exercise.tutorial?
                        
                            if representation.num_published_solutions.zero?
                        Severity: Minor
                        Found in app/commands/exercise/representation/sync_to_search_index.rb - About 55 mins 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 renderComponents has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function renderComponents(
                          parentElement: HTMLElement,
                          mappings: Mappings
                        ): void {
                          if (!parentElement) {
                        Severity: Minor
                        Found in app/javascript/utils/react-bootloader.tsx - About 55 mins 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 raw_content has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def raw_content
                            # We memoize this method
                            # Don't use `.presence?` here as the encoding might be incorrect
                            # and then the string check will raise an exception
                            return @raw_content if @raw_content && @raw_content != ""
                        Severity: Minor
                        Found in app/models/submission/file.rb - About 55 mins 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