Showing 142 of 1,394 total issues
Function expectFromDraw
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const expectFromDraw = async (drawTx: Promise<ContractTransactionResponse>) => {
console.log((await core.getRoundInfo(0, 0)).drawIterations);
expect(await core.getRoundInfo(0, 0).then((round) => round.drawIterations)).to.equal(3);
const tx = await (await drawTx).wait();
- Create a ticketCreate a ticket
Function handleChoiceFunded
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function handleChoiceFunded(event: ChoiceFunded): void {
const coreDisputeID = event.params._coreDisputeID.toString();
const coreRoundIndex = event.params._coreRoundID.toString();
const choice = event.params._choice;
const roundID = `${DISPUTEKIT_ID}-${coreDisputeID}-${coreRoundIndex}`;
- Create a ticketCreate a ticket
Function uploadFormDataToIPFS
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function uploadFormDataToIPFS(formData: FormData, operation = "evidence"): Promise<Response> {
const authToken = sessionStorage.getItem("authToken")?.replace(/"/g, "");
return toast.promise<Response, Error>(
fetch(`/.netlify/functions/uploadToIPFS?key=kleros-v2&operation=${operation}`, {
- Create a ticketCreate a ticket
Function expectFromDraw
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const expectFromDraw = async (drawTx: Promise<ContractTransactionResponse>) => {
console.log((await core.getRoundInfo(0, 0)).drawIterations);
expect(await core.getRoundInfo(0, 0).then((round) => round.drawIterations)).to.equal(3);
const tx = await (await drawTx).wait();
- Create a ticketCreate a ticket
Function VotingOptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const VotingOptions: React.FC = () => {
const { disputeData, setDisputeData } = useNewDisputeContext();
const handleQuestionWrite = (event: React.ChangeEvent<HTMLInputElement>) => {
setDisputeData({ ...disputeData, question: event.target.value });
- Create a ticketCreate a ticket
Function main
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function main() {
const chainId = Number(await hre.getChainId());
const courtAddress = configByChain.get(chainId)?.courtAddress ?? hre.ethers.ZeroAddress;
const courtsV1 = (await ethers.getContractAt("IKlerosLiquid", courtAddress)) as IKlerosLiquid;
- Create a ticketCreate a ticket
Function expectFromDraw
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const expectFromDraw = async (drawTx: Promise<ContractTransactionResponse>) => {
console.log((await core.getRoundInfo(0, 0)).drawIterations);
expect(await core.getRoundInfo(0, 0).then((round) => round.drawIterations)).to.equal(3);
const tx = await (await drawTx).wait();
- Create a ticketCreate a ticket
Function passPeriod
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const passPeriod = async (dispute: { id: string }) => {
const { core } = await getContracts();
let success = false;
try {
await core.passPeriod.staticCall(dispute.id);
- Create a ticketCreate a ticket
Function PersonFields
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const PersonFields: React.FC = () => {
const { disputeData, setDisputeData } = useNewDisputeContext();
const validationTimerRef = useRef<NodeJS.Timeout | null>(null);
const publicClient = usePublicClient({ chainId: 1 });
- 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 ChangeDeveloper
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const ChangeDeveloper: React.FC = () => {
const { isConnected, chainId } = useAccount();
const { arbitrable, currentDeveloper, refetchData } = useRulerContext();
const [newDeveloper, setNewDeveloper] = useState("");
const [isChanging, setIsChanging] = useState(false);
- 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 CasesGrid
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const CasesGrid: React.FC<ICasesGrid> = ({ disputes, casesPerPage, totalPages, currentPage, setCurrentPage }) => {
const { filter } = useParams();
const decodedFilter = decodeURIFilter(filter ?? "all");
const { id: searchValue } = decodedFilter;
const { isList } = useIsList();
- 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 beautifyStatNumber
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function beautifyStatNumber(value: number, invertValue: boolean = false): string {
const absValue = Math.abs(value);
if (absValue >= 1e9) {
return `${commify((value / 1e9).toFixed(2))}B`;
- 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 Onboarding
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const Onboarding: React.FC<IOnboarding> = ({ toggleMiniGuide }) => {
const [isStakingMiniGuideOpen, toggleStakingMiniGuide] = useToggle(false);
const [isBinaryVotingMiniGuideOpen, toggleBinaryVotingMiniGuide] = useToggle(false);
const [isRankedVotingMiniGuideOpen, toggleRankedVotingMiniGuide] = useToggle(false);
const [isAppealMiniGuideOpen, toggleAppealMiniGuide] = useToggle(false);
- 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 a Cognitive Complexity of 9 (exceeds 5 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);
- 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 fetchIpfsJsonAction
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const fetchIpfsJsonAction = async (mapping: FetchIpfsJsonMapping) => {
const { ipfsUri, seek, populate } = mapping;
let httpUri;
if (ipfsUri.startsWith("/ipfs/")) {
- 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 RewardsAndFundLabel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const RewardsAndFundLabel: React.FC<IRewardsAndFundLabel> = ({ value, unit = "ETH", isFund = false }) => {
const theme = useTheme();
const isWon = Number(value) > 0;
const color = isWon ? theme.success : theme.error;
return Number(value) !== 0 ? (
- 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 updateDisputeRequestData
has a Cognitive Complexity of 8 (exceeds 5 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;
- 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 ExecuteDelayedStakeButton
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const ExecuteDelayedStakeButton: React.FC<IExecuteStakeDelayedButton> = ({ setIsOpen }) => {
const [isSending, setIsSending] = useState(false);
const publicClient = usePublicClient();
const { data: phase } = useSortitionModulePhase();
const { data: delayedStakeWriteIndex } = useReadSortitionModuleDelayedStakeWriteIndex();
- 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
Avoid deeply nested control flow statements. Open
if (vote.choice === null) continue;
- Create a ticketCreate a ticket
Function Dashboard
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const Dashboard: React.FC = () => {
const { isConnected, address } = useAccount();
const { page, order, filter } = useParams();
const location = useRootPath();
const navigate = useNavigate();
- 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"