exercism/website

View on GitHub

Showing 287 of 1,073 total issues

Function Pagination has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function Pagination({
  disabled = false,
  current = 1,
  total,
  setPage,
Severity: Minor
Found in app/javascript/components/common/Pagination.tsx - About 45 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 NewListItemForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const NewListItemForm = <T extends unknown>({
  endpoint,
  expanded,
  contextId,
  onSuccess,
Severity: Minor
Found in app/javascript/components/common/NewListItemForm.tsx - About 45 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 Status has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function Status({
  activateInsiderLink,
  captchaRequired,
  insidersStatusRequest,
  links,
Severity: Minor
Found in app/javascript/components/insiders/InsidersStatus.tsx - About 45 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 StripeForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function StripeForm({
  paymentIntentType,
  amount,
  onSuccess,
  onProcessing = () => null,
Severity: Minor
Found in app/javascript/components/donations/StripeForm.tsx - About 45 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 FormOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const FormOptions = ({
  amount,
  links,
}: {
  amount: currency
Severity: Minor
Found in app/javascript/components/donations/subscription-form/FormOptions.tsx - About 45 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 AutomatedFeedback has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function AutomatedFeedback({
  iteration,
  track,
  automatedFeedbackInfoLink,
  open,

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

export const UpdatingOption = ({
  amount: currentAmount,
  updateLink,
  onClose,
}: {

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

Consider simplifying this complex logical expression.
Open

        if (
          status !== 'locked' &&
          status !== 'available' &&
          status !== 'started' &&
          status !== 'iterated' &&
Severity: Major
Found in app/javascript/components/student/ExerciseStatusChart.tsx - About 40 mins to fix

    Method perform has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def perform(action, gh_username, node_id, is_one_time, monthly_price_in_cents)
    Severity: Minor
    Found in app/jobs/process_github_sponsor_update_job.rb - About 35 mins to fix

      Method track_chart_values has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def track_chart_values(user_track, since, group_by, max, range)
      Severity: Minor
      Found in app/assemblers/assemble_journey_overview.rb - About 35 mins to fix

        Function setShadow has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          ctx: CanvasRenderingContext2D,
          color: string,
          offsetX: number,
          offsetY: number,
          blur: number

          Method nav_dropdown_element has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def nav_dropdown_element(title, description, icon, icon_filter, external)
          Severity: Minor
          Found in app/helpers/view_components/nav_helpers/nav_dropdown_helper.rb - About 35 mins to fix

            Method edit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def edit
                return redirect_to(action: :show) if @user_track.external?
                return redirect_to(action: :no_test_runner) unless @exercise.has_test_runner?
            
                @solution ||= Solution::Create.(current_user, @exercise)
            Severity: Minor
            Found in app/controllers/tracks/exercises_controller.rb - About 35 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 reveal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def reveal
                begin
                  track = Track.find(params[:track_slug])
                rescue StandardError
                  return render_404(:track_not_found, fallback_url: tracks_url)
            Severity: Minor
            Found in app/controllers/api/tracks/trophies_controller.rb - About 35 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 from_header has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.from_header(header)
                token = header.to_s.match(/^Token (.*)/) { |m| m[1] }
                return nil unless token
            
                token.split(",").find do |kv|
            Severity: Minor
            Found in lib/http_authentication_token.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def call
                return unless pushed_to_main?
            
                case repo_name
                when "website-copy"
            Severity: Minor
            Found in app/commands/webhooks/process_push_update.rb - About 35 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 handle_latest! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def handle_latest!
                return unless latest_submission
            
                # If we don't have a test runner then we shouldn't run anything so get out of here
                return Solution::UpdateLatestIterationHeadTestsStatus.(solution, :not_queued) unless exercise.has_test_runner?
            Severity: Minor
            Found in app/commands/solution/queue_head_test_run.rb - About 35 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 chatgpt_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def chatgpt_version
                usage = user.chatgpt_usage
                allowed_versions = []
            
                allowed_versions << '4.0' if !usage['4.0'] || usage['4.0'] < 3
            Severity: Minor
            Found in app/commands/submission/ai/chatgpt/request_help.rb - About 35 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 shortFromNow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            export function shortFromNow(dateTime: ConfigType) {
              const relative = fromNow(dateTime)
            
              if (relative == 'a few seconds ago' || relative === 'in a few seconds') {
                return 'now'
            Severity: Minor
            Found in app/javascript/utils/time.ts - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def call
                return false unless test_run
            
                if test_run.ops_errored?
                  status = :exceptioned
            Severity: Minor
            Found in app/commands/solution/sync_published_iteration_head_tests_status.rb - About 35 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