skyderby/skyderby

View on GitHub

Showing 132 of 841 total issues

File trackPoints.ts has 1622 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export default [
  {
    gpsTime: new Date(1484814388800),
    flTime: 500.2,
    absAltitude: 4130.414,
Severity: Major
Found in app/javascript/jest/fixtures/trackPoints.ts - About 4 days to fix

Function default has 195 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (google, map, width, length, direction, opts = {}) {
  const DLOverlay = class extends google.maps.OverlayView {
    constructor(map, width, length, direction, opts) {
      super()

Severity: Major
Found in app/javascript/utils/designated_lane.js - About 7 hrs to fix

Function UsersIndex has 165 lines of code (exceeds 25 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: Major
Found in app/javascript/components/Admin/Users/UsersIndex/index.tsx - About 6 hrs to fix

Function useChartOptions has 155 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useChartOptions = (
  points: PointRecord[],
  zeroWindPoints: PointRecord[],
  unitSystem: UnitSystem,
  additionalSeries: SeriesOptionsType[] = []

Function Indicators has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Indicators = forwardRef((_props, ref) => {
  const { t } = useI18n()
  const altitudeRef = useRef<HTMLSpanElement>(null)
  const fullSpeedRef = useRef<HTMLSpanElement>(null)
  const hSpeedRef = useRef<HTMLSpanElement>(null)
Severity: Major
Found in app/javascript/components/Tracks/Track/TrackVideo/Indicators.tsx - About 5 hrs to fix

Function PlacesIndex has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const PlacesIndex = () => {
  const navigate = useNavigate()
  const infoWindowRef = useRef()
  const markers = useRef<(google.maps.Marker & { placeId: number })[]>([])
  const [map, setMap] = useState<google.maps.Map | undefined>()
Severity: Major
Found in app/javascript/components/Places/PlacesIndex/index.tsx - About 5 hrs to fix

Function useRoundMapState has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useRoundMapState = (eventId: number, roundId: number) => {
  const { data: competitors = [] } = useCompetitorsQuery(eventId)
  const { data: results = [] } = useResultsQuery(eventId, {
    select: data => data.filter(result => result.roundId === roundId)
  })

Function Indicators has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

const Indicators = forwardRef((_props, ref) => {
  const { t } = useI18n()
  const altitudeRef = useRef<HTMLSpanElement>(null)
  const fullSpeedRef = useRef<HTMLSpanElement>(null)
  const hSpeedRef = useRef<HTMLSpanElement>(null)
Severity: Minor
Found in app/javascript/components/Tracks/Track/TrackVideo/Indicators.tsx - About 3 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 Form has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

const Form = ({ mutation }: FormProps): JSX.Element => {
  const { t } = useI18n()

  const handleSubmit = async (
    values: FormValues,
Severity: Minor
Found in app/javascript/components/Users/SignUp/Form.tsx - About 3 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 Map has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Map = (props: MapProps) => {
  const {
    children,
    autoFitBounds = false,
    options = {},
Severity: Major
Found in app/javascript/components/Map/index.tsx - About 3 hrs to fix

Function ForgotPassword has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ForgotPassword = () => {
  const { t } = useI18n()
  const [submitted, setSubmitted] = useState(false)
  const mutation = useResetPasswordMutation()
  const handleSubmit = (
Severity: Major
Found in app/javascript/components/Users/ForgotPassword/index.tsx - About 3 hrs to fix

Function useChartOptions has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useChartOptions = (onZoomChange: zoomChangeCallback): Options => {
  const { t } = useI18n()

  return useMemo<Options>(
    () => ({

Function useChartOptions has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useChartOptions = (zoomLevel: ZoomLevel = {}): Options => {
  return {
    chart: {
      type: 'spline',
      height: '150px'

Function usePageParams has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const usePageParams = () => {
  const navigate = useNavigate()
  const location = useLocation()
  const params = useMemo(() => extractParamsFromUrl(location.search), [location.search])

Severity: Major
Found in app/javascript/components/FlightProfiles/usePageParams.ts - About 2 hrs to fix

Function SignIn has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SignIn = (): JSX.Element => {
  const navigate = useNavigate()
  const location = useLocation()
  const { t } = useI18n()
  const loginMutation = useLoginMutation()
Severity: Major
Found in app/javascript/components/Users/SignIn/index.tsx - About 2 hrs to fix

Function FlightProfiles has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const FlightProfiles = (): JSX.Element => {
  const { t } = useI18n()
  const [zoomLevel, setZoomLevel] = useState<{ min: number; max: number } | null>(null)
  const [showModal, setShowModal] = useState(false)
  const [straightLine, setStraightLine] = useState<boolean>(getStraightLineSavedSetting)
Severity: Major
Found in app/javascript/components/FlightProfiles/index.tsx - About 2 hrs to fix

Function ResendConfirmation has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ResendConfirmation = () => {
  const { t } = useI18n()
  const [submitted, setSubmitted] = useState(false)
  const resendConfirmationMutation = useResendConfirmationMutation()
  const handleSubmit = (values: FormValues, formikHelpers: FormikHelpers<FormValues>) => {
Severity: Major
Found in app/javascript/components/Users/ResendConfirmation/index.tsx - About 2 hrs to fix

Function NewPassword has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const NewPassword = () => {
  const { t } = useI18n()
  const [params] = useSearchParams()
  const resetPasswordToken = params.get('reset_password_token') ?? ''
  const mutation = useCreatePasswordMutation()
Severity: Major
Found in app/javascript/components/Users/NewPassword/index.tsx - About 2 hrs to fix

Function getResponse has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function getResponse(event, client, requestId) {
  const { request } = event
  const requestClone = request.clone()
  const getOriginalResponse = () => fetch(requestClone)

Severity: Major
Found in public/mockServiceWorker.js - About 2 hrs to fix

Function User has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const User = () => {
  const params = useParams()
  const location = useLocation()
  const navigate = useNavigate()
  const userId = Number(params.id)
Severity: Major
Found in app/javascript/components/Admin/Users/User/index.tsx - About 2 hrs to fix
Severity
Category
Status
Source
Language