skyderby/skyderby

View on GitHub

Showing 132 of 841 total issues

Function buildSeries has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const buildSeries = (
  suitsWithPopularity: SuitWithPopularity[],
  manufacturers: ManufacturerRecord[]
) => {
  if (suitsWithPopularity.length === 0 || manufacturers.length === 0) return []
Severity: Major
Found in app/javascript/components/Suits/Overview/useChartOptions.ts - About 2 hrs to fix

Function TrackSuitField has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TrackSuitField = (): JSX.Element => {
  const { t } = useI18n()

  return (
    <div className={styles.inputContainer}>
Severity: Major
Found in app/javascript/components/TrackSuitField/index.tsx - About 2 hrs to fix

Function getDerivedStateFromProps has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static getDerivedStateFromProps(
    nextProps: SliderProps,
    prevState: SliderState
  ): Partial<SliderState> | null {
    const {
Severity: Major
Found in app/javascript/components/RangeSlider/Slider.tsx - About 2 hrs to fix

File useChartOptions.ts has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { useMemo } from 'react'
import type {
  AxisLabelsFormatterContextObject,
  Chart,
  Options,

Function TrackLocationField has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TrackLocationField = (): JSX.Element => {
  const { t } = useI18n()

  return (
    <div className={styles.inputContainer}>
Severity: Major
Found in app/javascript/components/TrackLocationField/index.tsx - About 2 hrs to fix

Function buildSeries has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const buildSeries = (points: PointRecord[]) => {
  const startTime = points[0]?.flTime ?? 0

  const altitudePoints = points.map(el => [
    Math.round((el.flTime - startTime) * 10) / 10,
Severity: Major
Found in app/javascript/components/AltitudeChart/useChartOptions.ts - About 2 hrs to fix

Function LeftMenu has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const LeftMenu = () => {
  const { t } = useI18n()
  const menuRef = useRef<HTMLUListElement>(null)
  const dropdownRef = useRef<HTMLDivElement>(null)
  const dropdownToggleRef = useRef<HTMLLIElement>(null)
Severity: Major
Found in app/javascript/components/AppShell/Navbar/DesktopMenu/LeftMenu.tsx - About 2 hrs to fix

Function UsersIndex has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

const UsersIndex = (): JSX.Element => {
  const { formatDate } = useI18n()
  const location = useLocation()
  const [searchParams, setSearchParams] = useSearchParams()
  const page = Number(searchParams.get('page')) || 1
Severity: Minor
Found in app/javascript/components/Admin/Users/UsersIndex/index.tsx - About 2 hrs 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 GroupShow has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const GroupShow = () => {
  const params = useParams()
  const id = Number(params.groupId)
  const location = useLocation()
  const urlParams = new URLSearchParams(location.search)
Severity: Major
Found in app/javascript/components/OnlineRankings/GroupShow/index.tsx - About 2 hrs to fix

Function webpackFinal has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  webpackFinal: async config => {
    const virtualModules = new VirtualModulesPlugin()

    config.plugins = [
      !isProduction && new ReactRefreshWebpackPlugin(),
Severity: Minor
Found in .storybook/main.js - About 1 hr to fix

Function TrackInsights has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const TrackInsights = ({ trackId }: TrackInsightsProps): JSX.Element => {
  const location = useLocation()
  const navigate = useNavigate()
  const { data: track } = useTrackQuery(trackId)
  const { data: points = [] } = useTrackPointsQuery(trackId)
Severity: Minor
Found in app/javascript/components/Tracks/Track/TrackInsights/index.tsx - About 1 hr 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 EventTypeSelect has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const EventTypeSelect = (): JSX.Element => {
  return (
    <div className={styles.container}>
      <h1 className={styles.pageTitle}>Choose event type</h1>

Severity: Minor
Found in app/javascript/components/Events/EventTypeSelect/index.tsx - About 1 hr to fix

Function EmailConfirmation has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const EmailConfirmation = () => {
  const { t } = useI18n()
  const [params] = useSearchParams()
  const confirmationToken = params.get('confirmation_token') ?? ''
  const mutation = useConfirmEmailMutation()
Severity: Minor
Found in app/javascript/components/Users/EmailConfirmation/index.tsx - About 1 hr to fix

Function drawPath has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function drawPath(
  ctx: CanvasRenderingContext2D,
  points: PlayerPoint[],
  color: string,
  rangeFrom: number,

Function useStickyTableHeader has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useStickyTableHeader = (
  tableRef: RefObject<HTMLTableElement>,
  containerRef: RefObject<AnyHTMLElement>
) => {
  const [isSticky, setIsSticky] = useState(false)
Severity: Minor
Found in app/javascript/hooks/useStickyTableHeader.tsx - About 1 hr to fix

Function getDerivedStateFromProps has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  static getDerivedStateFromProps(
    nextProps: SliderProps,
    prevState: SliderState
  ): Partial<SliderState> | null {
    const {
Severity: Minor
Found in app/javascript/components/RangeSlider/Slider.tsx - About 1 hr 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 EventsIndex has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const EventsIndex = (): JSX.Element => {
  const { t } = useI18n()
  const [searchParams, setSearchParams] = useSearchParams()
  const page = Number(searchParams.get('page') || 1)
  const searchTerm = searchParams.get('term') || ''
Severity: Minor
Found in app/javascript/components/Events/EventsIndex/index.tsx - About 1 hr to fix

Function App has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const App = () => {
  useLayoutEffect(() => {
    const keyPressListener = (e: KeyboardEvent) => {
      if (e.code !== 'Tab') return

Severity: Minor
Found in app/javascript/components/App.tsx - About 1 hr to fix

Function Show has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Show = () => {
  const params = useParams()
  const eventId = Number(params.eventId)
  const queryClient = useQueryClient()
  const [associationsLoaded, setAssociationsLoaded] = useState(false)

Function Show has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Show = () => {
  const params = useParams()
  const eventId = Number(params.eventId)
  const queryClient = useQueryClient()
  const [associationsLoaded, setAssociationsLoaded] = useState(false)
Severity
Category
Status
Source
Language