exercism/website

View on GitHub

Showing 287 of 1,073 total issues

Function EditListItemForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const EditListItemForm = <T extends ListItem>({
  item,
  onUpdate,
  onDelete,
  onCancel,
Severity: Minor
Found in app/javascript/components/common/EditListItemForm.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

Function Button has a Cognitive Complexity of 9 (exceeds 5 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 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 CopyToClipboardButton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function CopyToClipboardButton({
  textToCopy,
}: {
  textToCopy: string
}): JSX.Element {
Severity: Minor
Found in app/javascript/components/common/CopyToClipboardButton.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

Function IterationsList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function IterationsList({
  solutionUuid,
  request,
  exercise,
  track,
Severity: Minor
Found in app/javascript/components/student/IterationsList.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

Function Scratchpad has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const Scratchpad = ({
  scratchpad,
  track,
  exercise,
}: {
Severity: Minor
Found in app/javascript/components/mentoring/session/Scratchpad.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

Function UnrevealedTestimonial has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const UnrevealedTestimonial = ({
  testimonial,
  onRevealed,
  cacheKey,
  platforms,

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

export const ListItem = <T extends unknown>({
  item,
  action,
  onUpdate,
  onDelete,
Severity: Minor
Found in app/javascript/components/common/ListItem.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 handle_latest_published! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_latest_published!
    return unless latest_published_submission

    # If we don't have a test runner then we shouldn't run anything so get out of here
    return Solution::UpdatePublishedIterationHeadTestsStatus.(solution, :not_queued) unless exercise.has_test_runner?
Severity: Minor
Found in app/commands/solution/queue_head_test_run.rb - 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

Method call has a Cognitive Complexity of 8 (exceeds 5 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 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

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

  def call
    user.data.with_lock do
      if user.stripe_customer_id
        begin
          Stripe::Customer.retrieve(user.stripe_customer_id)
Severity: Minor
Found in app/commands/payments/stripe/customer/create_for_user.rb - 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

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

  def show
    @track_variants = Exercise.available.where(
      slug: params[:id],
      track_id: Track.active.select(:id)
    ).includes(:track).to_a
Severity: Minor
Found in app/controllers/generic_exercises_controller.rb - 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

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

  def show
    # Redirect to mentor queue if this is your own request
    return redirect_to mentoring_queue_path if @mentor_request.student_id == current_user.id

    # Handle cancelled requests
Severity: Minor
Found in app/controllers/mentoring/requests_controller.rb - 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

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

    def create
      ::Webhooks::ProcessPullRequestUpdate.(
        # params[:action] does not work as it is populated by Rails with the action method name
        action: request.request_parameters[:action],
        author_username: params[:pull_request][:user][:login],
Severity: Minor
Found in app/controllers/webhooks/pull_request_updates_controller.rb - 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 drawCircleWithEmoji has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  ctx: CanvasRenderingContext2D,
  x: number,
  y: number,
  radius: number,
  fontSize: number,

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

      const observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
          if (
            mutation.type === 'attributes' &&
            mutation.attributeName === 'class'
    Severity: Minor
    Found in app/javascript/utils/react-bootloader.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

    Method nav_dropdown has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def nav_dropdown(submenu, offset, has_view)
            tag.div class: "nav-element-dropdown #{has_view ? 'has-view' : 'has-no-view'}", style: "--dropdown-offset: -#{offset}px;",
              role: 'menu' do
              tag.ul do
                submenu.inject(''.html_safe) do |content, element|
    Severity: Minor
    Found in app/helpers/view_components/nav_helpers/nav_dropdown_helper.rb - 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

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

      def call
        status = recalculate_status ?
          User::InsidersStatus::DetermineEligibilityStatus.(user) :
          user.insiders_status
    
    
    Severity: Minor
    Found in app/commands/user/insiders_status/activate.rb - 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

    Method filter_status! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def filter_status!
        return if status.blank?
        raise TrackSearchStatusWithoutUserError unless user
        raise TrackSearchInvalidStatusError unless STATUSES.include?(status.to_sym)
        return if status == :all
    Severity: Minor
    Found in app/commands/track/search.rb - 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

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

      def call
        return unless user.discord_uid.present?
    
        [
          [MAINTAINER_ROLE_ID, user.maintainer?],
    Severity: Minor
    Found in app/commands/user/set_discord_roles.rb - 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 Track has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const Track = ({ track }: { track: StudentTrack }): JSX.Element => {
      return (
        <a className="--track e-hover-grow" href={track.webUrl}>
          <TrackIcon
            iconUrl={track.iconUrl}
    Severity: Minor
    Found in app/javascript/components/student/tracks-list/Track.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

    Severity
    Category
    Status
    Source
    Language