livepeer/livepeerjs

View on GitHub
packages/explorer-2.0/apollo/resolvers/Query.tsx

Summary

Maintainability
D
1 day
Test Coverage

Function getChartData has 216 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function getChartData(_obj?, _args?, _ctx?, _info?) {
  const data = {
    dayData: [],
    weeklyData: [],
    totalVolumeUSD: 0,
Severity: Major
Found in packages/explorer-2.0/apollo/resolvers/Query.tsx - About 1 day to fix

File Query.tsx has 324 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import dayjs from "dayjs";
import weekOfYear from "dayjs/plugin/weekOfYear";
import utc from "dayjs/plugin/utc";
import {
  getTwoPeriodPercentChange,
Severity: Minor
Found in packages/explorer-2.0/apollo/resolvers/Query.tsx - About 3 hrs to fix

Function threeBoxSpace has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function threeBoxSpace(_obj, _args, _ctx, _info) {
  const Utils = require("web3-utils");
  const { validateLink } = require("3id-blockchain-utils");
  const Box = require("3box");
  const id = _args.id.toLowerCase();
Severity: Minor
Found in packages/explorer-2.0/apollo/resolvers/Query.tsx - About 1 hr to fix

Function threeBoxSpace has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export async function threeBoxSpace(_obj, _args, _ctx, _info) {
  const Utils = require("web3-utils");
  const { validateLink } = require("3id-blockchain-utils");
  const Box = require("3box");
  const id = _args.id.toLowerCase();
Severity: Minor
Found in packages/explorer-2.0/apollo/resolvers/Query.tsx - About 1 hr to fix

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 getChartData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export async function getChartData(_obj?, _args?, _ctx?, _info?) {
  const data = {
    dayData: [],
    weeklyData: [],
    totalVolumeUSD: 0,
Severity: Minor
Found in packages/explorer-2.0/apollo/resolvers/Query.tsx - About 45 mins to fix

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

There are no issues that match your filters.

Category
Status