AugurProject/augur-ui

View on GitHub

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(
Severity: Minor
Found in src/modules/positions/reducers/account-trades.js - 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 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 &&
Severity: Minor
Found in src/modules/markets/helpers/order-and-assign-cumulative-shares.js - 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 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,
Severity: Minor
Found in src/modules/markets/helpers/order-for-market-depth.js - 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 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 (

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;
  }
Severity: Minor
Found in src/utils/should-component-update-pure.js - About 1 hr to fix

    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");
        });
    Severity: Minor
    Found in src/assertions/order-cancellation.js - About 1 hr to fix

      Function getWinningBalance has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const getWinningBalance = (marketIds = [], callback = logError) => (
        dispatch,
        getState
      ) => {
        const { loginAccount } = getState();
      Severity: Minor
      Found in src/modules/reports/actions/get-winning-balance.js - About 1 hr to fix

        Function getMainMenuData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getMainMenuData() {
            const { currentBasePath } = this.props;
            return [
              {
                label: "Dispute",
        Severity: Minor
        Found in src/modules/app/components/inner-nav/reporting-inner-nav.jsx - About 1 hr to fix

          Function insufficientFunds has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function insufficientFunds(
            validityBond,
            gasCost,
            designatedReportNoShowReputationBond,
            availableEth,
          Severity: Minor
          Found in src/modules/markets/helpers/insufficient-funds.js - About 1 hr to fix

            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);
            Severity: Minor
            Found in src/modules/modal/components/modal-network-connect.jsx - About 1 hr to fix

              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;
                  Severity: Minor
                  Found in integration/helpers/dismiss-disclaimer-modal.ts - About 1 hr to fix

                    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();
                      Severity: Minor
                      Found in src/assertions/common/initial-fair-prices.js - About 1 hr to fix

                        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(
                        Severity: Minor
                        Found in src/modules/reports/selectors/select-market-dispute-outcomes.js - About 1 hr to fix

                          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;
                          Severity: Minor
                          Found in src/modules/reports/selectors/get-payout-numerators.js - About 1 hr to fix

                            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);
                            
                            
                            Severity: Minor
                            Found in src/modules/auth/actions/show-edge-login.js - About 1 hr to fix

                              Function selectAverageTradeSize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                marketPriceHistory => {
                                  if (!marketPriceHistory) return 0;
                                  const initialState = {
                                    shares: ZERO,
                                    trades: 0
                              Severity: Minor
                              Found in src/modules/markets/selectors/user-markets.js - About 1 hr to fix

                                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
                                    });
                                Severity: Minor
                                Found in src/modules/auth/components/trezor-connect/trezor-connect.jsx - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language