AugurProject/augur-ui

View on GitHub

Showing 529 of 1,757 total issues

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

export const loadUniverse = (universeId, history, callback = logError) => (
  dispatch,
  getState
) => {
  const universePayload = { tx: { to: universeId } };
Severity: Minor
Found in src/modules/app/actions/load-universe.js - About 1 hr to fix

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

              const sendOrder = () => {
                augur.api.CreateOrder.publicCreateOrder({
                  meta: loginAccount.meta,
                  tx: { value: augur.utils.convertBigNumberToHexString(cost) },
                  _type: orderType,
    Severity: Minor
    Found in src/modules/orders/actions/liquidity-management.js - About 1 hr to fix

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

      const mapStateToProps = (state, ownProps) => {
        const market = selectMarket(ownProps.marketId);
        let openOrders = [];
        let positions = [];
      
      
      Severity: Minor
      Found in src/modules/market/containers/market-outcomes-and-positions.js - About 1 hr to fix

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

        const mapStateToProps = (state, ownProps) => {
          const { newMarket, loginAccount } = state;
        
          const selectedOutcome = ownProps.selectedOutcome.toString();
          const orderBook = formatOrderbook(newMarket.orderBook[selectedOutcome] || []);

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

            render() {
              const { location } = this.props;
              const s = this.state;
          
              return (
          Severity: Minor
          Found in src/modules/common/components/paginator/paginator.jsx - About 1 hr to fix

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

              changeMenu(nextBasePath) {
                const { isLogged } = this.props;
                const oldType = this.state.currentInnerNavType
                  ? navTypes[this.state.currentBasePath]
                  : this.state.currentInnerNavType;
            Severity: Minor
            Found in src/modules/app/components/app/app.jsx - About 1 hr to fix

              Function loadOneOutcomeBidsOrAsks has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              ) => (dispatch, getState) => {
                const { marketsData } = getState();
                if (marketId == null || outcome == null || orderTypeLabel == null) {
                  return callback(
                    `must specify market ID, outcome, and order type: ${marketId} ${outcome} ${orderTypeLabel}`
              Severity: Minor
              Found in src/modules/orders/actions/load-one-outcome-bids-or-asks.js - About 1 hr to fix

                Function cancelOpenOrdersInClosedMarkets has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const cancelOpenOrdersInClosedMarkets = () => dispatch => {
                  const openOrders = getOpenOrders();
                  if (openOrders && openOrders.length) {
                    const numMarketsWithOpenOrders = openOrders.length;
                    for (let i = 0; i < numMarketsWithOpenOrders; ++i) {
                Severity: Minor
                Found in src/modules/orders/actions/cancel-order.js - About 1 hr to fix

                  Function loadDisputing has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const loadDisputing = (callback = logError) => (dispatch, getState) => {
                    const { universe } = getState();
                    const args = {
                      sortBy: "endTime",
                      isSortDescending: false,
                  Severity: Minor
                  Found in src/modules/reports/actions/load-disputing.js - About 1 hr to fix

                    Function loadUserTradingHistory has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function loadUserTradingHistory(options = {}, callback = logError) {
                      return (dispatch, getState) => {
                        const { universe, loginAccount } = getState();
                        if (loginAccount.address == null) return callback(null);
                        if (options.marketId == null) dispatch(clearAccountTrades());
                    Severity: Minor
                    Found in src/modules/positions/actions/load-account-trades.js - About 1 hr to fix

                      Function mergeProps has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const mergeProps = (sP, dP, oP) => {
                        const marketId = parseQuery(oP.location.search)[MARKET_ID_PARAM_NAME];
                        const market = selectMarket(marketId);
                        let returnPath = parseQuery(oP.location.search)[RETURN_PARAM_NAME];
                        if (returnPath && returnPath.substring(0, 3) === "#!/") {
                      Severity: Minor
                      Found in src/modules/reporting/containers/reporting-report.js - About 1 hr to fix

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

                          validateScalar(validations, value, humanName, min, max, tickSize, isInvalid) {
                            const { updateState } = this.props;
                            const updatedValidations = { ...validations };
                            this.setState({ activeButton: ReportingReportForm.BUTTONS.SCALAR_VALUE });
                            const minValue = parseFloat(min);

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

                            render() {
                              const { transaction } = this.props;
                              const s = this.state;
                          
                              return (

                            Function default has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export default function(
                              pendingLiquidityOrders = DEFAULT_STATE(),
                              { type, data }
                            ) {
                              switch (type) {
                            Severity: Minor
                            Found in src/modules/orders/reducers/liquidity-orders.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 localStorageMiddleware has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const localStorageMiddleware = store => next => action => {
                              next(action);
                              const state = store.getState();
                              if (!state || !state.loginAccount || !state.loginAccount.address) {
                                return;
                            Severity: Minor
                            Found in src/store.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 addReportingTransactions has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function addReportingTransactions(reports) {
                              return (dispatch, getState) => {
                                const { marketsData } = getState();
                                const transactions = {};
                                eachOf(reports, (reports, universe) => {
                            Severity: Minor
                            Found in src/modules/transactions/actions/add-transactions.js - About 1 hr to fix

                              Function generateTradeOrders has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                (market, outcome, outcomeTradeInProgress) => {
                                  const tradeActions =
                                    outcomeTradeInProgress && outcomeTradeInProgress.tradeActions;
                                  if (
                                    !market ||
                              Severity: Minor
                              Found in src/modules/trades/helpers/generate-trade.js - About 1 hr to fix

                                Function toggleMenuTween has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  toggleMenuTween(menuKey, forceOpen, cb) {
                                    if (getValue(this.state[menuKey], "currentTween.stop"))
                                      this.state[menuKey].currentTween.stop();
                                
                                    let nowOpen = !this.state[menuKey].open;
                                Severity: Minor
                                Found in src/modules/app/components/app/app.jsx - About 1 hr to fix

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

                                    render() {
                                      const s = this.state;
                                      const { transaction } = this.props;
                                  
                                      return (

                                    Function pollForNetwork has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function pollForNetwork(dispatch, getState) {
                                      setInterval(() => {
                                        const { modal } = getState();
                                        dispatch(
                                          verifyMatchingNetworkIds((err, expectedNetworkId) => {
                                    Severity: Minor
                                    Found in src/modules/app/actions/init-augur.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language