AugurProject/augur-ui

View on GitHub

Showing 529 of 1,757 total issues

Function render has 55 lines of code (exceeds 25 allowed). Consider refactoring.
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

    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");
    Severity: Minor
    Found in src/modules/orders/selectors/user-open-orders.test.js - About 2 hrs to fix

      Function localStorageMiddleware has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const localStorageMiddleware = store => next => action => {
        next(action);
        const state = store.getState();
        if (!state || !state.loginAccount || !state.loginAccount.address) {
          return;
      Severity: Major
      Found in src/store.js - About 2 hrs to fix

        Function generateMarketsPositionsSummary has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          markets => {
            if (!markets || !markets.length) {
              return null;
            }
            let position = ZERO;
        Severity: Major
        Found in src/modules/positions/selectors/positions-summary.js - About 2 hrs to fix

          Function render has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          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

            export const loadReportingWindowBounds = (callback = logError) => (
              dispatch,
              getState
            ) => {
              const { universe, loginAccount } = getState();
            Severity: Major
            Found in src/modules/reports/actions/load-reporting-window-bounds.js - About 2 hrs to fix

              Function render has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
                  const { error, connect } = this.props;
                  return (
                    <div
                      ref={error => {
              Severity: Major
              Found in src/modules/auth/components/common/error-container.jsx - About 2 hrs to fix

                Function updateNotification has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function updateNotification(id, notification) {
                  return (dispatch, getState) => {
                    const callback = notification => {
                      const fullNotification = {
                        type: UPDATE_NOTIFICATION,
                Severity: Major
                Found in src/modules/notifications/actions/notifications.js - About 2 hrs to fix

                  File market-liquidity.jsx has 254 lines of code (exceeds 250 allowed). Consider refactoring.
                  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";
                  Severity: Minor
                  Found in src/modules/market/components/market-liquidity/market-liquidity.jsx - About 2 hrs to fix

                    Function helpers has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const helpers = store => {
                      const { dispatch, whenever } = store;
                      return {
                        updateAccountAddress: account =>
                          new Promise(resolve => {
                    Severity: Minor
                    Found in src/helpers/helpers.js - About 2 hrs 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 getOrderBookKeys has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    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);
                    Severity: Minor
                    Found in src/modules/markets/helpers/get-orderbook-keys.js - About 2 hrs 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 openZeroExInstant has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      openZeroExInstant: () => {
                        augur.api.Universe.getReputationToken((err, repTokenAddress) => {
                          if (err) return;
                    
                          const assetData = assetDataUtils.encodeERC20AssetData(repTokenAddress);
                    Severity: Major
                    Found in src/modules/account/containers/account-deposit.js - About 2 hrs to fix

                      Function render has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      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

                          render() {
                            const {
                              isLogged,
                              isMobile,
                              loadMarketsInfoIfNotLoaded,

                          Function render has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          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

                              render() {
                                const {
                                  markets,
                                  location,
                                  history,

                              Function trezorSigner has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                              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;
                              Severity: Minor
                              Found in src/modules/auth/helpers/trezor-signer.js - About 2 hrs to fix

                                Function drawTicks has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                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

                                    render() {
                                      const { options, alignLeft } = this.props;
                                      return (
                                        <div
                                          className={Styles.Dropdown}
                                  Severity: Minor
                                  Found in src/modules/common/components/dropdown/dropdown.jsx - About 2 hrs to fix

                                    Function updateInitialLiquidityCosts has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                    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);
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language