AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

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

          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 (

                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                    export const updateOrderBook = ({
                                      marketId,
                                      outcome,
                                      orderTypeLabel,
                                      orderBook
                                    Severity: Major
                                    Found in src/modules/orders/actions/update-order-book.js and 2 other locations - About 1 hr to fix
                                    src/modules/orders/actions/liquidity-management.js on lines 38..51
                                    src/modules/orders/actions/update-order-book.js on lines 28..41

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 67.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Identical blocks of code found in 2 locations. Consider refactoring.
                                    Open

                                    module.exports = {
                                      name: "integration",
                                      displayName: "Integration Tests",
                                    
                                      preset: "jest-puppeteer",
                                    Severity: Major
                                    Found in jest.integration.config.js and 1 other location - About 1 hr to fix
                                    jest-puppeteer.config.js on lines 1..13

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 67.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Similar blocks of code found in 3 locations. Consider refactoring.
                                    Open

                                        describe("format largish attoREP", () => {
                                          test("should return a properly formatted attoREP number", () => {
                                            const result = formatNumber.formatAttoRep("3496805826822916500000", {
                                              decimals: 4
                                            });
                                    Severity: Major
                                    Found in src/utils/format-number.test.js and 2 other locations - About 1 hr to fix
                                    src/utils/format-number.test.js on lines 428..435
                                    src/utils/format-number.test.js on lines 437..444

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 67.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language