Showing 131 of 843 total issues
Avoid too many return
statements within this function. Open
else if (speed > 130) return '#42C043'
- Create a ticketCreate a ticket
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.',
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return respondWithMock(clientMessage)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return getOriginalResponse()
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
else return '#2D7E2E'
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return null
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return getOriginalResponse()
- Create a ticketCreate a ticket
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, {
- Read upRead up
- Create a ticketCreate a ticket
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?
- Read upRead up
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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 ||
- Read upRead up
- Create a ticketCreate a ticket
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,
- Read upRead up
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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)
- Read upRead up
- Create a ticketCreate a ticket
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,
- Read upRead up
- Create a ticketCreate a ticket
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)
- Read upRead up
- Create a ticketCreate a ticket
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]
)
- Read upRead up
- Create a ticketCreate a ticket
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|
- Read upRead up
- Create a ticketCreate a ticket
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()
- Read upRead up
- Create a ticketCreate a ticket
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?)
- Read upRead up
- Create a ticketCreate a ticket
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"