Showing 529 of 1,757 total issues
Function render
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { order } = this.props;
const s = this.state;
const confirmStyle = {
File user-open-orders.test.js
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { formatEther, formatShares, formatNone } from "utils/format-number";
import { CLOSE_DIALOG_CLOSING } from "modules/markets/constants/close-dialog-status";
import store from "src/store";
jest.mock("src/store");
Function localStorageMiddleware
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const localStorageMiddleware = store => next => action => {
next(action);
const state = store.getState();
if (!state || !state.loginAccount || !state.loginAccount.address) {
return;
Function generateMarketsPositionsSummary
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
markets => {
if (!markets || !markets.length) {
return null;
}
let position = ZERO;
Function render
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { pendingOrders, position } = this.props;
const orderText = pendingOrders.length > 1 ? "Orders" : "Order";
return (
Function loadReportingWindowBounds
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const loadReportingWindowBounds = (callback = logError) => (
dispatch,
getState
) => {
const { universe, loginAccount } = getState();
Function render
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { error, connect } = this.props;
return (
<div
ref={error => {
Function updateNotification
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function updateNotification(id, notification) {
return (dispatch, getState) => {
const callback = notification => {
const fullNotification = {
type: UPDATE_NOTIFICATION,
File market-liquidity.jsx
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component } from "react";
import PropTypes from "prop-types";
import classNames from "classnames";
import ChevronFlip from "modules/common/components/chevron-flip/chevron-flip";
import { createBigNumber } from "utils/create-big-number";
Function helpers
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
export const helpers = store => {
const { dispatch, whenever } = store;
return {
updateAccountAddress: account =>
new Promise(resolve => {
- Read upRead up
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 getOrderBookKeys
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
const getOrderBookKeys = memoize((marketDepth, minPrice, maxPrice) => {
let min = marketDepth[BIDS].reduce((p, order, i) => {
if (i === 0) return order[1];
return order[1] < p ? order[1] : p;
}, null);
- Read upRead up
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 openZeroExInstant
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
openZeroExInstant: () => {
augur.api.Universe.getReputationToken((err, repTokenAddress) => {
if (err) return;
const assetData = assetDataUtils.encodeERC20AssetData(repTokenAddress);
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { history, location, markets, marketIds } = this.props;
const { designated, open, upcoming } = markets;
const { paginations, PAGINATION_LENGTH } = this.state;
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
isLogged,
isMobile,
loadMarketsInfoIfNotLoaded,
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { newMarket } = this.props;
const { outcomes } = newMarket;
const cleanedOutcomes = outcomes.filter(outcome => outcome !== "");
const totalOutcomes = cleanedOutcomes.length;
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
markets,
location,
history,
Function trezorSigner
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const trezorSigner = async (connect, path, dispatch, rawTxArgs) => {
function hex(num) {
let str = prefixHex(num).slice(2);
if (str.length % 2 !== 0) str = "0" + str;
return str;
Function drawTicks
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function drawTicks(options) {
const { drawParams, chart, pricePrecision } = options;
// Y axis
// Bounds
Function render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { options, alignLeft } = this.props;
return (
<div
className={Styles.Dropdown}
Function updateInitialLiquidityCosts
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updateInitialLiquidityCosts(order, shouldReduce) {
const { availableEth, newMarket, updateNewMarket } = this.props;
const minPrice = newMarket.type === SCALAR ? newMarket.scalarSmallNum : 0;
const maxPrice = newMarket.type === SCALAR ? newMarket.scalarBigNum : 1;
const shareBalances = newMarket.outcomes.map(outcome => 0);