Showing 142 of 1,394 total issues
Function Stats
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const Stats = () => {
const { id } = useParams();
const { data } = useCourtDetails(id);
const [selectedRange, setSelectedRange] = useState(timeRanges[0].value);
const timeframedCourtData = useHomePageExtraStats(selectedRange);
- 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 updateJurorEffectiveStake
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function updateJurorEffectiveStake(jurorAddress: string, courtID: string): void {
let court = Court.load(courtID);
if (!court) {
return;
}
- 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 uploadToIpfs
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function uploadToIpfs(config: Config, payload: IpfsUploadPayload): Promise<string | null> {
const formData = new FormData();
formData.append("file", payload.file, payload.name);
formData.append("name", payload.name);
formData.append("product", payload.product);
- Create a ticketCreate a ticket
Function General
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const General: React.FC = () => {
const { address, chain } = useAccount();
const addressExplorerLink = useMemo(() => {
return `${chain?.blockExplorers?.default.url}/address/${address}`;
- Create a ticketCreate a ticket
Function deployResolver
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const deployResolver: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers } = hre;
const template = `{
"$schema": "../NewDisputeTemplate.schema.json",
- Create a ticketCreate a ticket
Function deployForeignGateway
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId, config } = hre;
const { deploy, execute } = deployments;
const { zeroPadValue, toBeHex } = ethers;
- Create a ticketCreate a ticket
Function Court
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Court: React.FC = () => {
const { disputeData, setDisputeData } = useNewDisputeContext();
const { data } = useCourtTree();
const items = useMemo(() => !isUndefined(data) && [rootCourtToItems(data.court)], [data]);
- Create a ticketCreate a ticket
Function Policy
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Policy: React.FC = () => {
const { disputeData, setDisputeData, setIsPolicyUploading } = useNewDisputeContext();
const { uploadFile } = useAtlasProvider();
const handleFileUpload = (file: File) => {
- Create a ticketCreate a ticket
Function ExtraStats
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ExtraStats = () => {
const [selectedRange, setSelectedRange] = useState(timeRanges[0].value);
const data = useHomePageExtraStats(selectedRange);
const handleTimeRangeChange = (value: string | number) => {
- Create a ticketCreate a ticket
Function deployForeignGateway
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId, config } = hre;
const { execute } = deployments;
const { zeroPadValue, toBeHex } = ethers;
- Create a ticketCreate a ticket
Function updateDisputeRequestData
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const updateDisputeRequestData = (event: DisputeCreation): void => {
const dispute = Dispute.load(event.params._disputeID.toString());
if (!dispute) return;
const receipt = event.receipt;
- Create a ticketCreate a ticket
Function handleSubmit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (!address) {
return;
}
- Create a ticketCreate a ticket
Function getCourtsPath
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const getCourtsPath = (
node: CourtTreeQuery["court"],
id: string | undefined,
path: IItem[] = []
): IItem[] | null => {
- 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 processData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const processData = (data: HomePageBlockQuery, allTime: boolean) => {
const presentCourts = data.presentCourts;
const pastCourts = data.pastCourts;
const processedCourts: CourtWithTree[] = Array(presentCourts.length);
const processed = new Set();
- 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 QuantityToSimulate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const QuantityToSimulate: React.FC<IQuantityToSimulate> = ({
isStaking,
jurorCurrentEffectiveStake,
jurorCurrentSpecificStake,
amountToStake,
- 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 getFormattedRewards
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const getFormattedRewards = (data: any, pricesData: any) => {
return rewards.map(({ token, coinId, getValue, getAmount }) => {
const coinPrice = !isUndefined(pricesData) ? pricesData[CoinIds[token]]?.price : undefined;
const totalReward = data && calculateTotalJurorReward(coinId, data);
- 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 isRngReady
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const isRngReady = async () => {
const { randomizerRng, blockHashRNG, sortition } = await getContracts();
const currentRng = await sortition.rng();
if (currentRng === randomizerRng?.target) {
const requesterID = await randomizerRng.requesterToID(sortition.target);
- Create a ticketCreate a ticket
Function executeDelayedStakes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const executeDelayedStakes = async () => {
const { sortition } = await getContracts();
// delayedStakes = 1 + delayedStakeWriteIndex - delayedStakeReadIndex
const delayedStakesRemaining =
- Create a ticketCreate a ticket
Function accordionItems
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const accordionItems = useMemo(() => {
return drawnJurors
.map((drawnJuror) =>
!isUndefined(drawnJuror.vote?.justification?.choice)
? {
- Create a ticketCreate a ticket
Function updateCountsAndGetCurrentRuling
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function updateCountsAndGetCurrentRuling(id: string, choice: BigInt, delta: BigInt): CurrentRulingInfo {
const round = ClassicRound.load(id);
if (!round) return { ruling: ZERO, tied: false };
const choiceNum = choice.toI32();
const newChoiceCount = round.counts[choiceNum].plus(delta);
- Create a ticketCreate a ticket