skyderby/skyderby

View on GitHub

Showing 131 of 843 total issues

Avoid too many return statements within this function.
Open

  else if (speed > 130) return '#42C043'
Severity: Major
Found in app/javascript/utils/colorBySpeed.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return event.respondWith(
    handleRequest(event, requestId).catch((error) => {
      if (error.name === 'NetworkError') {
        console.warn(
          '[MSW] Successfully emulated a network error for the "%s %s" request.',
Severity: Major
Found in public/mockServiceWorker.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return respondWithMock(clientMessage)
Severity: Major
Found in public/mockServiceWorker.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return getOriginalResponse()
Severity: Major
Found in public/mockServiceWorker.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  else return '#2D7E2E'
Severity: Major
Found in app/javascript/utils/colorBySpeed.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return null
Severity: Major
Found in app/javascript/components/Tracks/Track/TrackVideo/getPointsAroundTime.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return getOriginalResponse()
Severity: Major
Found in public/mockServiceWorker.js - About 30 mins to fix

Function TrackVideoSettings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const TrackVideoSettings = ({ trackId }: TrackVideoSettingsProps) => {
  const navigate = useNavigate()
  const { t } = useI18n()
  const { data: track } = useTrackQuery(trackId)
  const { data: video, isLoading } = useTrackVideoQuery(trackId, {
Severity: Minor
Found in app/javascript/components/Tracks/Track/TrackVideoSettings/index.tsx - About 25 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 profile_attributes_valid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def profile_attributes_valid
      if new_profile?
        errors.add(:name, :blank) if name.blank?
        errors.add(:country_id, :blank) if country_id.blank?
      elsif profile_id.blank?
Severity: Minor
Found in app/models/events/competitor_registration.rb - About 25 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 for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.for(date_time)
      today = Date.current
      date_range = (today - DATASETS_HISTORY_DAYS)..(today + DAYS_IN_DATASET)
      raise DateOutOfRange unless date_range.cover? date_time.to_date

Severity: Minor
Found in app/services/gfs_grads_fetcher/dataset.rb - About 25 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 have_intersecting_bounds? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.have_intersecting_bounds?(segment1, segment2)
      intersects_on_x_axis =
        (segment1.leftmost_endpoint.x < segment2.rightmost_endpoint.x ||
        segment1.leftmost_endpoint.x == segment2.rightmost_endpoint.x) &&
        (segment2.leftmost_endpoint.x < segment1.rightmost_endpoint.x ||
Severity: Minor
Found in lib/geometry/segment.rb - About 25 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 ResultCell has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ResultCell = ({
  className,
  event,
  roundId,
  competitorId,

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

        def lookup_section(round: nil, section: nil, competitor: nil) # rubocop:disable Metrics/PerceivedComplexity,Metrics/CyclomaticComplexity
          if round && section
            :by_rounds_and_sections
          elsif round && competitor
            :by_rounds_and_competitors
Severity: Minor
Found in app/presenters/events/scoreboards/results/collection.rb - About 25 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 RoundReplay has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const RoundReplay = ({ eventId, roundId }: RoundReplayProps) => {
  const queryClient = useQueryClient()
  const { data: event } = usePerformanceCompetitionSuspenseQuery(eventId)
  const { data: round } = useRoundQuery(eventId, roundId)
  const { data: competitors = [] } = useCompetitorsQuery(eventId)

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

      def sort_competitors(collection)
        collection.sort_by do |competitor|
          [
            competitor.is_disqualified ? 1 : 0,
            competitor.best_result.present? ? 0 : 1,
Severity: Minor
Found in app/presenters/tournaments/qualifications/competitors_collection.rb - About 25 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 extractParamsFromUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const extractParamsFromUrl = (
  urlSearch: string,
  prefix = ''
): Omit<IndexParams, 'filters'> & { filters: FilterTuple[] } => {
  const allParams = new URLSearchParams(urlSearch)
Severity: Minor
Found in app/javascript/api/tracks/urlParams.ts - About 25 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 CompetitorCards has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  ({ group }, ref) => {
    const cardRefs = useMemo(
      () => Object.fromEntries(group.map(({ id }) => [id, createRef<HTMLDivElement>()])),
      [group]
    )

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

  def assign_ranks(standings)
    return standings unless standings.any?

    standings.first[:rank] = 1
    standings.each_cons(2).with_index do |(prev, curr), index|
Severity: Minor
Found in app/models/speed_skydiving_competition/team_standings.rb - About 25 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 mapParamsToUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const mapParamsToUrl = (
  { activity, filters = [], search, page, sortBy }: IndexParams,
  prefix?: string
): string => {
  const params = new URLSearchParams()
Severity: Minor
Found in app/javascript/api/tracks/urlParams.ts - About 25 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 find_or_create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def find_or_create(opts)
      params = opts.slice(:name, :latitude, :longitude)

      return if params[:name].blank? && (params[:latitude].blank? || params[:longitude].blank?)

Severity: Minor
Found in app/models/event/reference_point.rb - About 25 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