Showing 32 of 91 total issues
File MainLayout.js
has 514 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { keyframes } from "@emotion/core"
import { Location } from "@reach/router"
import axios from "axios"
import { Link } from "gatsby"
import _ from "lodash"
File ZoneMasterView.js
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { faSearch, faChevronDown } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import React, { useCallback, useState } from "react"
import {
buttonStyle,
File ElectionMap.js
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { keyBy, uniq, uniqBy } from "lodash"
import {
quadtree,
event as d3Event,
mouse as d3Mouse,
Function partyStatsFromSummaryJSON
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
export function partyStatsFromSummaryJSON(
summary,
{
filter = filters.all,
fillAllSeats = false,
- Read upRead up
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
File DesktopScoreBar.js
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable no-magic-numbers */
import { transition as d3Transition } from "d3"
import { scaleBand, scaleLinear } from "d3-scale"
import { SvgChart, helper } from "d3kit"
import _ from "lodash"
File TimeMachine.js
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useEffect, useState, useRef } from "react"
import { useDirectoryOverride } from "../models/TimeTraveling"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import {
faHistory,
Function ElectionMapTooltip
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export default function ElectionMapTooltip({ positionId, positions }) {
const memo = useMemo(() => {
const position = _.find(positions, p => p.id == positionId)
if (!position) return {}
- Read upRead up
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 TimeMachine
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export function TimeMachine() {
const styles = {
button: {
cursor: "pointer",
border: 0,
- Read upRead up
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
File DesktopScoreBarContainer.js
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useState, useEffect } from "react"
import _ from "lodash"
import DesktopScoreBar from "./DesktopScoreBar"
import HelpTooltip from "./HelpTooltip"
import { nationwidePartyStatsFromSummaryJSON } from "../models/PartyStats"
File PerZoneView.js
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { navigate } from "gatsby"
import _ from "lodash"
import React, { useContext } from "react"
import CandidateStatsRow from "./CandidateStatsRow"
import CloseButton from "./CloseButton"
Function onlyPassThroughPropsWhilePageIsVisible
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export default function onlyPassThroughPropsWhilePageIsVisible(BaseComponent) {
return class UpdateBlocker extends React.Component {
componentWillUnmount() {
if (this.listener) {
const Visibility = require("visibilityjs")
- Read upRead up
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 MainLayout
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export default function MainLayout({ children, activeNavBarSection }) {
const [navBarActive, toggleNavBar] = useReducer(state => !state, false)
const [active, setActive] = useState(false)
const [tooltipPayload, setTooltipPayload] = useState({})
- Read upRead up
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 DataInspector
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function DataInspector() {
const latestDirectoryState = useLatestDirectoryState()
const summaryState = useSummaryData()
return (
<ContentWrapper>
- Read upRead up
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 renderScore
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
renderScore() {
let cumulative = 0
let inputParties = this.data()
// prepare dimension and scales
const margin = this.options().margin
- Read upRead up
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 getWinningConstituencyCandidates
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function getWinningConstituencyCandidates(summaryState, partyId) {
if (!summaryState.completed) {
return []
} else {
const summary = summaryState.data
- Read upRead up
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 ZonePageContainer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function ZonePageContainer({ pageContext, location }) {
/** @type {ZoneFilterName | null} */
const filterNameFromRoute = pageContext.zoneView
? null
: pageContext.filterName || "all"
- Read upRead up
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 ZoneCandidateList
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function ZoneCandidateList({ provinceId, zoneNo, zoneStats }) {
const dataState = usePerZoneData(provinceId, zoneNo)
if (!dataState.completed || !zoneStats) {
if (dataState.failed) {
return <LoadingError />
- Read upRead up
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 getLatestDirectoryState
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function getLatestDirectoryState() {
if (overrideDirectory.get()) {
return {
completed: true,
data: overrideDirectory.get(),
- Read upRead up
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 getMapData
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function getMapData(summaryState, filter) {
if (!summaryState.completed) {
return electionMapLoadingData
} else {
/** @type {ElectionDataSource.SummaryJSON} */
- Read upRead up
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 getMapData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getMapData(summaryState, partyId) {
if (!summaryState.completed) {
return electionMapLoadingData
} else {
/** @type {ElectionDataSource.SummaryJSON} */
- Read upRead up
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"