Showing 113 of 1,343 total issues
Function VoteStatus
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
}> = ({ choice, period, answers, isActiveRound, commited, hiddenVotes }) => {
if (hiddenVotes) {
if (!commited && (isActiveRound ? ["vote", "appeal", "execution"].includes(period) : true))
return <StyledLabel>Did not commit vote </StyledLabel>;
- 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 NextButton
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const NextButton: React.FC<INextButton> = ({ nextRoute }) => {
const navigate = useNavigate();
const { disputeData, isPolicyUploading } = useNewDisputeContext();
const location = useLocation();
- 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 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;
// fallback to hardhat node signers on local network
- Create a ticketCreate a ticket
Function calculateStats
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const calculateStats = (
isCourtFilter: boolean,
courtData: CourtDetailsQuery["court"],
counters: CounterQuery["counter"],
filter?: Dispute_Filter
- 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 handleNewPeriod
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function handleNewPeriod(event: NewPeriod): void {
const disputeID = event.params._disputeID;
const dispute = Dispute.load(disputeID.toString());
if (!dispute) return;
const court = Court.load(dispute.court);
- Create a ticketCreate a ticket
Function PersonFields
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
const PersonFields: React.FC = () => {
const { disputeData, setDisputeData } = useNewDisputeContext();
const validationTimerRef = useRef<NodeJS.Timeout | null>(null);
const publicClient = usePublicClient({ chainId: 1 });
- Create a ticketCreate a ticket
Function Search
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Search: React.FC = () => {
const { page, order, filter } = useParams();
const location = useRootPath();
const decodedFilter = decodeURIFilter(filter ?? "all");
const { id: searchValue, ...filterObject } = decodedFilter;
- Create a ticketCreate a ticket
Function JurorBalanceDisplay
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
const JurorBalanceDisplay = () => {
const { id } = useParams();
const { address } = useAccount();
const { data: jurorBalance } = useReadSortitionModuleGetJurorBalance({
query: {
- Create a ticketCreate a ticket
Function updateCountsAndGetCurrentRuling
has a Cognitive Complexity of 15 (exceeds 5 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);
- 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 Dashboard
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Dashboard: React.FC = () => {
const { isConnected, address } = useAccount();
const { page, order, filter } = useParams();
const location = useRootPath();
const navigate = useNavigate();
- Create a ticketCreate a ticket
Function handleEvidenceEvent
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function handleEvidenceEvent(event: EvidenceEvent): void {
const evidenceGroupID = event.params._externalDisputeID.toString();
const evidenceGroup = ensureClassicEvidenceGroup(evidenceGroupID);
const evidenceIndex = evidenceGroup.nextEvidenceIndex;
evidenceGroup.nextEvidenceIndex = evidenceGroup.nextEvidenceIndex.plus(ONE);
- Create a ticketCreate a ticket
Function DisputeResolver
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const DisputeResolver: React.FC = () => {
const location = useLocation();
const [isDisputeResolverMiniGuideOpen, toggleDisputeResolverMiniGuide] = useToggle(false);
const { isConnected } = useAccount();
const isPreviewPage = location.pathname.includes("/preview");
- Create a ticketCreate a ticket
Function withdrawAppealContribution
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const withdrawAppealContribution = async (
disputeId: string,
roundId: string,
contribution: Contribution
): Promise<boolean> => {
- Create a ticketCreate a ticket
Function Chart
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Chart: React.FC = () => {
const [chartOption, setChartOption] = useState("stakedPNK");
const { data } = useHomePageContext();
const chartData = data?.counters;
const courtsChartData = data?.courts;
- Create a ticketCreate a ticket
Function CourtDetails
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CourtDetails: React.FC = () => {
const { id } = useParams();
const { data: policy } = useCourtPolicy(id);
const { data } = useCourtTree();
const [isStakingMiniGuideOpen, toggleStakingMiniGuide] = useToggle(false);
- Create a ticketCreate a ticket
Function main
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default async function main() {
logger.info("Starting up");
const core = (await ethers.getContract("KlerosCore")) as KlerosCore;
const resolver = (await ethers.getContract("DisputeResolver")) as DisputeResolver;
- Create a ticketCreate a ticket
Function commify
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function commify(value: string | number): string {
const comps = String(value).split(".");
if (!String(value).match(/^-?[0-9]*\.?[0-9]*$/)) {
return "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 handleNewPeriod
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function handleNewPeriod(event: NewPeriod): void {
const disputeID = event.params._disputeID;
const dispute = Dispute.load(disputeID.toString());
if (!dispute) return;
const court = Court.load(dispute.court);
- 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 useTimeline
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const useTimeline = (dispute: DisputeDetailsQuery["dispute"], currentItemIndex: number, currentPeriodIndex: number) => {
const isDesktop = useIsDesktop();
const titles = useMemo(() => {
const titles = ["Evidence", "Voting", "Appeal", "Executed"];
if (dispute?.court.hiddenVotes) {
- 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 Description
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Description: React.FC = () => {
const { id } = useParams();
const { data: policy } = useCourtPolicy(id);
const navigate = useNavigate();
const currentPathName = useLocation().pathname.split("/").at(-1);
- Create a ticketCreate a ticket