kleros/kleros-v2

View on GitHub

Showing 1,278 of 1,394 total issues

Similar blocks of code found in 5 locations. Consider refactoring.
Open

const StyledText = styled.label<{ contentColor: string }>`
  font-size: 12px;
  font-weight: 400;
  color: ${({ contentColor }) => contentColor};
`;
Severity: Major
Found in web/src/components/DisputeView/CardLabels/Label.tsx and 4 other locations - About 35 mins to fix
web/src/components/DisputeView/CardLabels/Label.tsx on lines 15..23
web/src/components/DisputeView/CardLabels/Label.tsx on lines 25..34
web/src/components/DisputeView/CardLabels/RewardsAndFundLabel.tsx on lines 16..23
web/src/components/DisputeView/CardLabels/RewardsAndFundLabel.tsx on lines 25..27

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

const StyledLabel = styled.label<{ color: string }>`
  color: ${({ color }) => color};
`;
web/src/components/DisputeView/CardLabels/Label.tsx on lines 15..23
web/src/components/DisputeView/CardLabels/Label.tsx on lines 25..34
web/src/components/DisputeView/CardLabels/Label.tsx on lines 36..40
web/src/components/DisputeView/CardLabels/RewardsAndFundLabel.tsx on lines 16..23

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

interface IWithHelpTooltip {
  tooltipMsg: string;
  place?: "bottom" | "left" | "right" | "top";
  children?: React.ReactNode;
}
Severity: Minor
Found in web/src/components/WithHelpTooltip.tsx and 1 other location - About 35 mins to fix
web-devtools/src/components/WithHelpTooltip.tsx on lines 31..35

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

interface IWithHelpTooltip {
  tooltipMsg: string;
  place?: "bottom" | "left" | "right" | "top";
  children?: React.ReactNode;
}
Severity: Minor
Found in web-devtools/src/components/WithHelpTooltip.tsx and 1 other location - About 35 mins to fix
web/src/components/WithHelpTooltip.tsx on lines 31..35

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 5 locations. Consider refactoring.
Open

const IconContainer = styled.div<{ contentColor: string }>`
  height: 14px;
  width: 14px;
  display: flex;
  align-items: center;
Severity: Major
Found in web/src/components/DisputeView/CardLabels/Label.tsx and 4 other locations - About 35 mins to fix
web/src/components/DisputeView/CardLabels/Label.tsx on lines 15..23
web/src/components/DisputeView/CardLabels/Label.tsx on lines 36..40
web/src/components/DisputeView/CardLabels/RewardsAndFundLabel.tsx on lines 16..23
web/src/components/DisputeView/CardLabels/RewardsAndFundLabel.tsx on lines 25..27

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid too many return statements within this function.
Open

    return `after ${targetDate.toLocaleDateString("en-US", options)}`;
Severity: Major
Found in web/src/utils/date.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return false;
Severity: Major
Found in contracts/scripts/keeperBot.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

    if (period === "execution" && isDrawnInDispute && !hasVotedInDispute) return LabelArgs.DidNotVote;
Severity: Major
Found in web/src/components/DisputeView/CardLabels/index.tsx - About 30 mins to fix

Avoid too many return statements within this function.
Open

    if (!isDrawnCurrentRound) return LabelArgs.NotDrawn;
Severity: Major
Found in web/src/components/DisputeView/CardLabels/index.tsx - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return [secondsToDayHourMinute(dispute?.court.timesPerPeriod[index])];
Severity: Major
Found in web/src/pages/Cases/CaseDetails/Timeline.tsx - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return value.toFixed(2);
Severity: Major
Found in web/src/utils/beautifyStatNumber.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

    if (["commit", "vote"].includes(period ?? "") && !hasVotedCurrentRound) return LabelArgs.CanVote;
Severity: Major
Found in web/src/components/DisputeView/CardLabels/index.tsx - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return `in ${daysLeft} day${daysLeft > 1 ? "s" : ""}`;
Severity: Major
Found in web/src/utils/date.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

    if (hasVotedCurrentRound) return LabelArgs.Voted; // plus rewards if execution
Severity: Major
Found in web/src/components/DisputeView/CardLabels/index.tsx - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return;
Severity: Major
Found in subgraph/core/src/entities/Dispute.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

    if (!decoded) return;
Severity: Major
Found in subgraph/core/src/entities/Dispute.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return commify(value.toFixed(0));
Severity: Major
Found in web/src/utils/beautifyStatNumber.ts - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return LabelArgs.DidNotVote; // plus rewards if execution
Severity: Major
Found in web/src/components/DisputeView/CardLabels/index.tsx - About 30 mins to fix

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const useIsDesktop = () => {
  const { width } = useWindowSize();
  return useMemo(() => width > BREAKPOINT_LANDSCAPE, [width]);
};
Severity: Minor
Found in web-devtools/src/hooks/useIsDesktop.tsx and 1 other location - About 30 mins to fix
web/src/hooks/useIsDesktop.tsx on lines 7..10

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 45.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    await hre.run("simulate:pass-period", { walletindex: operator.toString(), disputeid: dispute.id.toString() });
Severity: Major
Found in contracts/scripts/simulations/tasks.ts and 3 other locations - About 30 mins to fix
contracts/scripts/simulations/tasks.ts on lines 514..517
contracts/scripts/simulations/tasks.ts on lines 529..529
contracts/scripts/simulations/tasks.ts on lines 547..547

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 45.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language