AugurProject/augur-ui

View on GitHub

Showing 529 of 1,757 total issues

Function attachHoverClickHandlers has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function attachHoverClickHandlers(options) {
  const {
    drawParams,
    depthChart,
    marketDepth,

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

      render() {
        const { openOrders, outcome, positions } = this.props;
        const s = this.state;
    
        return (

      Function getReportingFees has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const getReportingFees = (callback = logError) => (
        dispatch,
        getState
      ) => {
        const { universe, loginAccount } = getState();
      Severity: Minor
      Found in src/modules/reports/actions/get-reporting-fees.js - About 1 hr to fix

        Function validateScalar has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          validateScalar(value, humanName, min, max, tickSize, isInvalid) {
            const { updateState, validations } = this.props;
            const updatedValidations = { ...validations };
            const { inputRepAmount } = this.state;
        
        

          Function selectTransactionsTotalsCreator has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          export const selectTransactionsTotalsCreator = () =>
            createSelector(selectTransactions, transactions => {
              const o = {
                numWorking: 0,
                numPending: 0,
          Severity: Minor
          Found in src/modules/transactions/selectors/transactions-totals.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 render has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            render() {
              const {
                market,
                currentTimestamp,
                tentativeWinner,
          Severity: Minor
          Found in src/modules/market/components/core-properties/core-properties.jsx - 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 mergeProps has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const mergeProps = (sP, dP, oP) => {
            const { marketId, cb } = sP.modal;
            const market = selectMarket(marketId);
            const { description, outstandingReturns } = market;
            const { gasCost } = sP;
          Severity: Minor
          Found in src/modules/modal/containers/modal-claim-trading-proceeds.js - About 1 hr to fix

            Function assertMyMarkets has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function assertMyMarkets(market) {
              describe(`myMarket's shape`, () => {
                test("id", () => {
                  expect(market.id).toBeDefined();
                  expect(typeof market.id).toBe("string");
            Severity: Minor
            Found in src/assertions/my-markets.js - About 1 hr to fix

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

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

                Function orderAndAssignCumulativeShares has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  (orderBook, userOpenOrders, loginAccount) => {
                    const rawBids = ((orderBook || {})[BIDS] || []).slice();
                    const bids = rawBids.sort((a, b) => b.price.value - a.price.value).reduce(
                      (p, order, i, orders) => [
                        ...p,
                Severity: Minor
                Found in src/modules/markets/helpers/order-and-assign-cumulative-shares.js - About 1 hr to fix

                  Function validateType has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    validateType(value) {
                      const { isValid, newMarket, updateNewMarket } = this.props;
                      const updatedMarket = { ...newMarket };
                      const validations = updatedMarket.validations[newMarket.currentStep];
                  
                  

                    Function validateTag has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      validateTag(fieldName, value, maxLength, isRequired = true) {
                        const { isValid, newMarket, updateNewMarket } = this.props;
                        const { currentStep } = newMarket;
                        const { localValues } = this.state;
                        const updatedMarket = { ...newMarket };

                      Function calculateMarketCreationCosts has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        calculateMarketCreationCosts() {
                          const { meta, universe, newMarket, gasPrice } = this.props;
                      
                          augur.createMarket.getMarketCreationCostBreakdown(
                            { universe: universe.id, meta },

                        Function componentWillReceiveProps has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          componentWillReceiveProps(nextProps, nextState) {
                            const { newMarket, gasPrice } = this.props;
                            if (
                              newMarket.initialLiquidityEth !== nextProps.newMarket.initialLiquidityEth
                            )

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

                          export const loadAccountOrders = (options = {}, callback = logError) => (
                            dispatch,
                            getState
                          ) => {
                            const { universe, loginAccount } = getState();
                          Severity: Minor
                          Found in src/modules/orders/actions/load-account-orders.js - About 1 hr to fix

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

                              withdrawReview() {
                                const { withdrawReviewModal, closeModal } = this.props;
                                const s = this.state;
                                if (s.isValid) {
                                  withdrawReviewModal({

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

                              const CreateMarketLiquidityOrders = props => {
                                const { newMarket, liquidityState, removeOrderFromNewMarket } = props;
                                const defaultOutcome = newMarket.type !== CATEGORICAL ? 1 : "";
                                const selectedOutcome =
                                  liquidityState && liquidityState.selectedOutcome

                                Consider simplifying this complex logical expression.
                                Open

                                    if (
                                      !isEqual(marketDepth, nextProps.marketDepth) ||
                                      !isEqual(orderBookKeys, nextProps.orderBookKeys) ||
                                      !isEqual(sharedChartMargins, nextProps.sharedChartMargins) ||
                                      !isEqual(updateHoveredPrice, nextProps.updateHoveredPrice) ||

                                  Function mapStateToProps has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const mapStateToProps = state => {
                                    const positions = getLoginAccountPositions();
                                    const openOrders = getOpenOrders();
                                    const orphanedOrders = selectOrphanOrders(state);
                                    const orphanedMarkets = [];
                                  Severity: Minor
                                  Found in src/modules/portfolio/containers/positions.js - About 1 hr to fix

                                    Function getUniverseInfo has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function getUniverseInfo(universeId, callback) {
                                      const universeData = {
                                        id: universeId,
                                        reportableOutcomes: null,
                                        winningChildUniverseId: null,
                                    Severity: Minor
                                    Found in src/modules/universe/actions/load-universe-info.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language