Showing 113 of 1,343 total issues
Avoid too many return
statements within this function. Open
if (["commit", "vote"].includes(period ?? "") && !hasVotedCurrentRound) return LabelArgs.CanVote;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
if (!isDrawnCurrentRound) return LabelArgs.NotDrawn;
- Create a ticketCreate a ticket
Function CasesFetcher
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const CasesFetcher: React.FC = () => {
const { page, order, filter } = useParams();
const location = useRootPath();
const navigate = useNavigate();
const isDesktop = useIsDesktop();
- 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 replacePlaceholdersWithValues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const replacePlaceholdersWithValues = (mapping: any, context: Record<string, unknown>) => {
const replace = (obj) => {
if (typeof obj === "string") {
return mustache.render(obj, context);
} else if (Array.isArray(obj)) {
- 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 deployArbitration
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId } = hre;
const { AddressZero } = hre.ethers.constants;
const RNG_LOOKAHEAD = 20;
- 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 6 (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 VotesAccordion
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const VotesAccordion: React.FC<IVotesAccordion> = ({ drawnJurors, period, answers, isActiveRound, hiddenVotes }) => {
const accordionItems = useMemo(() => {
return drawnJurors
.map((drawnJuror) =>
!isUndefined(drawnJuror.vote?.justification?.choice)
- 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 ensureClassicContributionFromEvent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function ensureClassicContributionFromEvent<T>(event: T): ClassicContribution | null {
if (!(event instanceof ContributionEvent) && !(event instanceof Withdrawal)) return null;
const coreDisputeID = event.params._coreDisputeID.toString();
const coreRoundIndex = event.params._coreRoundID.toString();
const roundID = `${DISPUTEKIT_ID}-${coreDisputeID}-${coreRoundIndex}`;
- 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 deployArbitration
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId } = hre;
const { deploy, execute } = deployments;
const { AddressZero } = hre.ethers.constants;
const RNG_LOOKAHEAD = 20;
- 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 DrawButton
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const DrawButton: React.FC<IDrawButton> = ({ id, numberOfVotes, setIsOpen, period }) => {
const [isSending, setIsSending] = useState(false);
const publicClient = usePublicClient();
const { data: maintenanceData } = useDisputeMaintenanceQuery(id);
const { data: phase } = useSortitionModulePhase();
- 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 getActivityDelta
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getActivityDelta(previousStake: BigInt, newStake: BigInt): BigInt {
if (previousStake.gt(ZERO)) {
return newStake.gt(ZERO) ? ZERO : BigInt.fromI32(-1);
} else {
return newStake.gt(ZERO) ? ONE : ZERO;
- 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 Popup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const Popup: React.FC<PopupProps & IPopup> = ({
title,
icon: Icon,
popupType,
setIsOpen,
- 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 getNewValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getNewValue(currentVar: string, targetVar: string, delta: BigInt, counter: Entity | null): Value {
if (currentVar === targetVar) {
return !counter ? Value.fromBigInt(delta) : Value.fromBigInt(counter.get(currentVar)!.toBigInt().plus(delta));
} else {
return !counter ? Value.fromBigInt(ZERO) : counter.get(currentVar)!;
- 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"