Showing 113 of 1,343 total issues
Function OptionsFields
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const OptionsFields: React.FC = () => {
const { disputeData, setDisputeData } = useNewDisputeContext();
const updateOptions = (value: number) => {
const defaultAnswer: Answer = { title: "", id: value.toString(), description: "" };
- Create a ticketCreate a ticket
Function commify
has 36 lines of code (exceeds 25 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";
- Create a ticketCreate a ticket
Function CasesFetcher
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CasesFetcher: React.FC = () => {
const { page, order, filter } = useParams();
const location = useRootPath();
const navigate = useNavigate();
const isDesktop = useIsDesktop();
- Create a ticketCreate a ticket
Function deployForeignGateway
has 35 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;
// fallback to hardhat node signers on local network
- Create a ticketCreate a ticket
Function useTimeline
has 34 lines of code (exceeds 25 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) {
- Create a ticketCreate a ticket
Function updateTokenAndEthShiftFromEvent
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function updateTokenAndEthShiftFromEvent(event: TokenAndETHShiftEvent): void {
const jurorAddress = event.params._account;
const disputeID = event.params._disputeID;
const dispute = Dispute.load(disputeID.toString());
if (!dispute) return;
- Create a ticketCreate a ticket
Function handleVoteCast
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function handleVoteCast(event: VoteCast): void {
const juror = event.params._juror.toHexString();
const coreDisputeID = event.params._coreDisputeID.toString();
const coreDispute = Dispute.load(coreDisputeID);
const classicDisputeID = `${DISPUTEKIT_ID}-${coreDisputeID}`;
- Create a ticketCreate a ticket
Function Chart
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const Chart: React.FC = () => {
const [chartOption, setChartOption] = useState("stakedPNK");
const { data } = useHomePageContext();
const chartData = data?.counters;
const courtsChartData = data?.courts;
- 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 getFundingRewards
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const getFundingRewards = (contributions: ClassicContribution[], closed: boolean) => {
if (isUndefined(contributions) || contributions.length === 0) return 0;
const contribution = contributions.reduce((acc, val) => {
if (isUndefined(val?.rewardAmount) && isUndefined(val?.amount)) return acc;
if (closed) {
- 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 constructDisputeTemplate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const constructDisputeTemplate = (disputeData: IDisputeData) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { courtId, numberOfJurors, arbitrationCost, ...baseTemplate } = disputeData;
if (!isUndefined(baseTemplate.aliasesArray)) {
- 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 resolveUserDispute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function resolveUserDispute(id: string, previousFeeAmount: BigInt, feeAmount: BigInt, disputeID: string): void {
const user = ensureUser(id);
if (user.resolvedDisputes.includes(disputeID)) {
if (previousFeeAmount.gt(ZERO)) {
if (feeAmount.le(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 deployArbitration
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;
// fallback to hardhat node signers on local network
- Create a ticketCreate a ticket
Function Policy
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Policy: React.FC = () => {
const { disputeData, setDisputeData, setIsPolicyUploading } = useNewDisputeContext();
const handleFileUpload = (file: File) => {
setIsPolicyUploading(true);
- 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 Explore
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Explore: React.FC = () => {
const location = useLocation();
const { isOpen, toggleIsOpen } = useOpenContext();
return (
- 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 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 { hexZeroPad, hexlify } = ethers.utils;
- Create a ticketCreate a ticket
Function authMiddleware
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const authMiddleware = () => {
return {
before: async (request) => {
const { event } = request;
- 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 { deploy, execute } = deployments;
const { hexZeroPad, hexlify } = ethers.utils;
- Create a ticketCreate a ticket