Showing 529 of 1,757 total issues
Function default
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function(accountTrades = DEFAULT_STATE, { type, data }) {
switch (type) {
case UPDATE_ACCOUNT_TRADES_DATA: {
const { tradeData, market } = data;
const updatedMarketOutcomes = Object.keys(tradeData || {}).reduce(
- 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 calculateMySize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function calculateMySize(openOrders, loginAccount, price) {
if (openOrders) {
const accountOrdersInPrice = (Object.keys(openOrders) || []).filter(
key =>
openOrders[key].owner === loginAccount &&
- 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 orderForMarketDepth
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const orderForMarketDepth = orderBook => {
const rawBids = ((orderBook || {})[BIDS] || []).slice();
const bids = rawBids.reduce(
(p, order) => [
...p,
- 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 constructor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
constructor(props) {
super(props);
let selectedOutcome = props.newMarket.type === CATEGORICAL ? "" : 1;
if (
- 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 isShallowUnEqual
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function isShallowUnEqual(obj1, obj2, log) {
// both arguments reference the same object
if (obj1 === obj2) {
return false;
}
Function default
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function(orderCancellation) {
describe("orderCancellation", () => {
test("orderCancellation", () => {
expect(typeof orderCancellation).toBe("object");
});
Function getWinningBalance
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getWinningBalance = (marketIds = [], callback = logError) => (
dispatch,
getState
) => {
const { loginAccount } = getState();
Function getMainMenuData
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
getMainMenuData() {
const { currentBasePath } = this.props;
return [
{
label: "Dispute",
Function insufficientFunds
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function insufficientFunds(
validityBond,
gasCost,
designatedReportNoShowReputationBond,
availableEth,
Function submitForm
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
submitForm(e) {
const { submitForm, env } = this.props;
const { ethereumNode, augurNode } = this.state;
let ethNode = {};
const protocol = this.calcProtocol(ethereumNode);
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const s = this.state;
const { transaction } = this.props;
return (
Function processEndTime
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
static processEndTime(newMarket) {
if (!newMarket.setEndTime) {
return newMarket.endTime;
}
Function dismissDisclaimerModal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const dismissDisclaimerModal = async (page: Page) => {
const isModalDismissed = await page.evaluate(() =>
window.integrationHelpers.hasDisclaimerModalBeenDismissed()
);
if (isModalDismissed) return;
Function spacing
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const spacing = (loc, direction) => {
if (direction !== NONE) {
switch (`${loc}|${direction}`) {
case "yes-no-scalar|up":
return { bottom: "0.975rem" };
Function default
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function(initialFairPrices, refObj) {
describe(`${refObj}'s initiaiFairPrices`, () => {
describe("type", () => {
test("should exist", () => {
expect(initialFairPrices.type).toBeDefined();
Function selectMarketDisputeOutcomes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
(markets, universe) => {
if (isEmpty(markets) || !universe.forkThreshold) {
return {};
}
const disputeMarkets = markets.filter(
Function getPayoutNumerators
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getPayoutNumerators = (market, selectedOutcome, invalid) => {
const { maxPrice, minPrice } = market;
const numTicks = createBigNumber(market.numTicks);
const payoutNumerators = Array(market.numOutcomes).fill(createBigNumber(0));
const isScalar = market.marketType === SCALAR;
Function showEdgeLogin
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const showEdgeLogin = history => (dispatch, getState) => {
const state = getState();
const edgeContext = selectEdgeContextState(state);
const edgeLoading = selectEdgeLoadingState(state);
Function selectAverageTradeSize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
marketPriceHistory => {
if (!marketPriceHistory) return 0;
const initialState = {
shares: ZERO,
trades: 0
Function connectWallet
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async connectWallet(derivationPath) {
const { loginWithTrezor, logout } = this.props;
const result = await TrezorConnect.ethereumGetAddress({
path: derivationPath
});