exercism/website

View on GitHub

Showing 287 of 1,073 total issues

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

    def to_turbo_stream
      controller.render(options.merge(formats: :html))
    rescue ActionView::MissingTemplate => e
      raise e if get?

Severity: Minor
Found in app/controllers/turbo_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 sudo_update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def sudo_update
    unless current_user.valid_password?(params.dig(:user, :sudo_password))
      Rails.logger.debug "Wrong password"

      return render_400(:incorrect_password)
Severity: Minor
Found in app/controllers/api/settings_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 user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def user
    custom_data = event.metadata['custom']
    return unless custom_data

    user_id = custom_data.gsub(/^user-/, '').to_i
Severity: Minor
Found in app/commands/payments/coinbase/handle_resolved_charge.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 useLockedSolutionMentoringNote has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function useLockedSolutionMentoringNote(
  request: MentorSessionRequest
): useLockedSolutionMentoringNoteReturns {
  const [lockedUntil, setLockedUntil] = useState(dayjs(request.lockedUntil))
  const [diff, setDiff] = useState(lockedUntil.diff(dayjs(), 'minute'))

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

const Component = ({
  sizeVariant = 'large',
  tracks,
  isFetching,
  value,
Severity: Minor
Found in app/javascript/components/mentoring/automation/TrackFilterList.tsx - 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 Credits has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function Credits({
  topLabel,
  topCount,
  bottomLabel,
  bottomCount,
Severity: Minor
Found in app/javascript/components/common/Credits.tsx - 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 DiscussionActions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const DiscussionActions = ({
  discussion,
  links,
  donation,
}: DiscussionActionsProps): JSX.Element => {

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

const Component = ({
  sizeVariant = 'large',
  tracks,
  isFetching,
  value,
Severity: Minor
Found in app/javascript/components/community/video-grid/TrackFilterList.tsx - 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 UnrevealedBadge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const UnrevealedBadge = ({
  badge,
  cacheKey,
}: {
  badge: BadgeProps
Severity: Minor
Found in app/javascript/components/journey/UnrevealedBadge.tsx - 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 CroppingStep has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const CroppingStep = ({
  state,
  dispatch,
}: {
  state: State

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

export default function Introducer({
  icon,
  content,
  children,
  endpoint,
Severity: Minor
Found in app/javascript/components/common/Introducer.tsx - 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 Representations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function Representations({
  tracks,
  counts,
  links,
  representationsRequest,
Severity: Minor
Found in app/javascript/components/mentoring/automation/Representation.tsx - 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 Component has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const Component = ({
  sizeVariant = 'large',
  tracks,
  isFetching,
  value,
Severity: Minor
Found in app/javascript/components/mentoring/queue/TrackFilterList.tsx - 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

Avoid too many return statements within this function.
Open

      return compartment.of(StreamLanguage.define(abapMode))
Severity: Major
Found in app/javascript/components/misc/CodeMirror/languageCompartment.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return compartment.of(StreamLanguage.define(shell))
    Severity: Major
    Found in app/javascript/components/misc/CodeMirror/languageCompartment.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            if (parser.version) return compareVersions(parser.version, '80') >= 0
      Severity: Major
      Found in app/javascript/utils/regex-check.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return compartment.of(php())
        Severity: Major
        Found in app/javascript/components/misc/CodeMirror/languageCompartment.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return compartment.of(rust())
          Severity: Major
          Found in app/javascript/components/misc/CodeMirror/languageCompartment.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  if (parser.version) return compareVersions(parser.version, '14.9') >= 0
            Severity: Major
            Found in app/javascript/utils/regex-check.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    if (parser.version) return compareVersions(parser.version, '49') >= 0
              Severity: Major
              Found in app/javascript/utils/regex-check.ts - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language