skyderby/skyderby

View on GitHub

Showing 132 of 841 total issues

Function drawCard has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const drawCard = (
  ctx: CanvasRenderingContext2D,
  el: { profile: ProfileRecord },
  idx = 0
) => {

Function drawChart has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function drawChart(ctx: CanvasRenderingContext2D, rangeFrom: number, rangeTo: number) {
  const fontSize = 36

  ctx.clearRect(0, 0, chartWidth * 0.97, chartHeight)

Function RightMenu has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const RightMenu = (): JSX.Element => {
  const { t } = useI18n()
  const location = useLocation()
  const [showModal, setShowModal] = useState(false)
  const { data: currentUser, isLoading } = useCurrentUserQuery()
Severity: Minor
Found in app/javascript/components/AppShell/Navbar/DesktopMenu/RightMenu.tsx - About 1 hr to fix

Function refreshTooltipHandler has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const refreshTooltipHandler = (chart: Chart | undefined) => (
  evt: React.MouseEvent | React.TouchEvent
) => {
  if (!chart) return

Severity: Minor
Found in app/javascript/components/Highchart/utils.ts - 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 TrackList has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const TrackList = (): JSX.Element => {
  const {
    params: { tracksParams, selectedTracks },
    updateFilters,
    toggleTrack
Severity: Minor
Found in app/javascript/components/FlightProfiles/TrackList/index.tsx - About 1 hr to fix

Function useStickyTableHeader has a Cognitive Complexity of 12 (exceeds 5 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

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 Sidebar has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Sidebar = (): JSX.Element => {
  const { data: allSuits = [] } = useAllSuitsQuery()
  const { data: allManufacturers = [] } = useManufacturersQuery()

  const productsCountByMake = allSuits.reduce<Record<string, number>>((acc, suit) => {
Severity: Minor
Found in app/javascript/components/Suits/IndexLayout/Sidebar/index.tsx - About 1 hr to fix

Function set_bounds has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    set_bounds(point) {
      const center_lat = point.lat()
      const center_lon = point.lng()

      const top_point = Geospatial.destiantion_by_bearing_and_distance(
Severity: Minor
Found in app/javascript/utils/designated_lane.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

    if (
      prevState.step === null ||
      prevState.domain === null ||
      prevState.reversed === null ||
      step !== prevState.step ||
Severity: Critical
Found in app/javascript/components/RangeSlider/Slider.tsx - About 1 hr to fix

Function Tagbar has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Tagbar = (): JSX.Element => {
  const {
    params: { selectedTracks, selectedTerrainProfile, additionalTerrainProfiles },
    setSelectedTerrainProfile,
    deleteAdditionalTerrainProfile,
Severity: Minor
Found in app/javascript/components/FlightProfiles/Tagbar/index.tsx - About 1 hr to fix

Function drawSpeedometer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function drawSpeedometer(
  ctx: CanvasRenderingContext2D,
  textX: number,
  textY: number,
  point: { vSpeed: number }

Function Track has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Track = (): JSX.Element | null => {
  const params = useParams()
  const trackId = Number(params.id)
  const { data: track } = useTrackQuery(trackId)

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

Function Group has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Group = <Option extends OptionType, Group extends GroupTypeBase<Option>>(
  props: GroupProps<Option, true, Group>
) => {
  const {
    children,

Function TokenizedSearchField has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const TokenizedSearchField = ({
  initialValues = [],
  onChange,
  exclude
}: TokenizedSearchFieldProps): JSX.Element => {
Severity: Minor
Found in app/javascript/components/TokenizedSearchField/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 getPointsAroundTime has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const getPointsAroundTime = <TPoint extends { flTime: number }>(
  points: TPoint[],
  time: number
) => {
  let start = 0

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 mostDistantPoint has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const mostDistantPoint = (
  points: PointRecord[],
  laneEnterPoint: Coordinate,
  referencePoint: Coordinate,
  startPoint: PointRecord,
Severity: Minor
Found in app/javascript/utils/checkLaneViolation.ts - About 1 hr to fix

Function exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = api => {
  api.cache.using(() => process.env.NODE_ENV)

  return {
    presets: [
Severity: Minor
Found in babel.config.js - About 1 hr to fix

Function Admin has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Admin = () => {
  const { data: currentUser, isLoading } = useCurrentUserQuery()

  if (isLoading) return null

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

Function getLaneViolation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const getLaneViolation = (
  points: PointRecord[],
  laneEnterPoint: PointRecord,
  referencePoint: Coordinate,
  exitWindowPoint: PointRecord
Severity: Minor
Found in app/javascript/utils/checkLaneViolation.ts - About 1 hr to fix

Function create_rotate_marker has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    create_rotate_marker() {
      const icon = {
        path: 'M 0, 0 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0',
        fillOpacity: 0.5,
        strokeWeight: 2,
Severity: Minor
Found in app/javascript/utils/designated_lane.js - About 1 hr to fix
Severity
Category
Status
Source
Language