AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

Function getTradeStatus has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function getTradeStatus(
  marketTradingHistory,
  marketId,
  outcomeId,
  getTradeType

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 MarketOutcomeCandlestickHeader has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const MarketOutcomeCandlestickHeader = ({
  outcomeName,
  isMobile,
  volume,
  fixedPrecision,

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 validateType has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

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 addMarketCreationTransactions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function addMarketCreationTransactions(marketsCreated) {
  return (dispatch, getState) => {
    const marketCreationData = {};
    const { loginAccount, marketsData } = getState();
    each(marketsCreated, marketIdOrObject => {
Severity: Minor
Found in src/modules/transactions/actions/add-transactions.js - About 1 hr to fix

    Function getUserOpenOrders has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getUserOpenOrders(
      marketId,
      orders,
      orderType,
      outcomeId,
    Severity: Minor
    Found in src/modules/orders/selectors/user-open-orders.js - About 1 hr to fix

      Function syncBlockchain has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const syncBlockchain = () => (dispatch, getState) => {
        const { gasPriceInfo } = getState();
        const blockNumber = parseInt(augur.rpc.getCurrentBlock().number, 16);
        augur.api.Controller.getTimestamp((err, augurTimestamp) => {
          if (err) console.error(err);
      Severity: Minor
      Found in src/modules/app/actions/sync-blockchain.js - About 1 hr to fix

        Function getForkMigrationTotals has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const getForkMigrationTotals = (universeId, callback = logError) => (
          dispatch,
          getState
        ) => {
          const { marketsData, universe } = getState();
        Severity: Minor
        Found in src/modules/forking/actions/get-fork-migration-totals.js - About 1 hr to fix

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

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

            Function handleMarketFinalizedLog has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                loadMarketsInfo([log.market], err => {
                  if (err) return console.error(err);
                  const { author } = getState().marketsData[log.market];
                  dispatch(loadReporting([log.market]));
                  dispatch(getWinningBalance([log.market]));
            Severity: Minor
            Found in src/modules/events/actions/log-handlers.js - About 1 hr to fix

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

                render() {
                  const { closeModal, marketDescription, type } = this.props;
                  const { gasEstimate } = this.state;
                  const reviewDetails = {
                    title: "Migrate Market",
              Severity: Minor
              Found in src/modules/modal/components/modal-migrate-market.jsx - About 1 hr to fix

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

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

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

                    render() {
                      const { selectedOutcome, validateOutcome } = this.props;
                  
                      const { formattedMigrationTotals } = this.state;
                  
                  

                    Function determineDrawParams has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function determineDrawParams(options) {
                      const {
                        drawContainer,
                        maxPrice,
                        minPrice,

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

                        test(`multiple buy down trades in market`, () => {
                          const actual = selectMarketOutcomeTradingIndicator(marketTradingHistory, {
                            id: 1,
                            marketId: "marketId2_buy"
                          });
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 26..33
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 35..42
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 44..52
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 64..72
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 74..82
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 84..92

                      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 63.

                      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 6 locations. Consider refactoring.
                      Open

                          const action1 = newMarket(newMarketState, {
                            type: ADD_ORDER_TO_NEW_MARKET,
                            data: {
                              order: {
                                outcome: "Outcome1",
                      Severity: Major
                      Found in src/modules/markets/reducers/new-market.test.js and 5 other locations - About 1 hr to fix
                      src/modules/markets/reducers/new-market.test.js on lines 83..94
                      src/modules/markets/reducers/new-market.test.js on lines 134..145
                      src/modules/markets/reducers/new-market.test.js on lines 197..208
                      src/modules/markets/reducers/new-market.test.js on lines 267..278
                      src/modules/markets/reducers/new-market.test.js on lines 280..291

                      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 63.

                      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 6 locations. Consider refactoring.
                      Open

                          const action2 = newMarket(action1, {
                            type: ADD_ORDER_TO_NEW_MARKET,
                            data: {
                              order: {
                                outcome: "Outcome1",
                      Severity: Major
                      Found in src/modules/markets/reducers/new-market.test.js and 5 other locations - About 1 hr to fix
                      src/modules/markets/reducers/new-market.test.js on lines 83..94
                      src/modules/markets/reducers/new-market.test.js on lines 134..145
                      src/modules/markets/reducers/new-market.test.js on lines 197..208
                      src/modules/markets/reducers/new-market.test.js on lines 254..265
                      src/modules/markets/reducers/new-market.test.js on lines 280..291

                      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 63.

                      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 7 locations. Consider refactoring.
                      Open

                        test(`no trades in market`, () => {
                          const actual = selectMarketOutcomeTradingIndicator(marketTradingHistory, {
                            id: 1,
                            marketId: "marketId1"
                          });
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 35..42
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 44..52
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 54..62
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 64..72
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 74..82
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 84..92

                      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 63.

                      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 7 locations. Consider refactoring.
                      Open

                        test(`multiple sell up trades in market`, () => {
                          const actual = selectMarketOutcomeTradingIndicator(marketTradingHistory, {
                            id: 2,
                            marketId: "marketId2_sell"
                          });
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 26..33
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 35..42
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 44..52
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 54..62
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 64..72
                      src/modules/markets/selectors/select-market-outcome-trading-indicator.test.js on lines 74..82

                      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 63.

                      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 6 locations. Consider refactoring.
                      Open

                          const actual = newMarket(newMarketState, {
                            type: ADD_ORDER_TO_NEW_MARKET,
                            data: {
                              order: {
                                outcome: "Outcome1",
                      Severity: Major
                      Found in src/modules/markets/reducers/new-market.test.js and 5 other locations - About 1 hr to fix
                      src/modules/markets/reducers/new-market.test.js on lines 134..145
                      src/modules/markets/reducers/new-market.test.js on lines 197..208
                      src/modules/markets/reducers/new-market.test.js on lines 254..265
                      src/modules/markets/reducers/new-market.test.js on lines 267..278
                      src/modules/markets/reducers/new-market.test.js on lines 280..291

                      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 63.

                      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 4 locations. Consider refactoring.
                      Open

                          case UPDATE_MARKET_CATEGORY: {
                            const { marketId, category } = action.data;
                            if (!marketId) return marketsData;
                            return {
                              ...marketsData,
                      Severity: Major
                      Found in src/modules/markets/reducers/markets-data.js and 3 other locations - About 1 hr to fix
                      src/modules/markets/reducers/markets-data.js on lines 42..52
                      src/modules/markets/reducers/markets-data.js on lines 53..63
                      src/modules/markets/reducers/markets-data.js on lines 64..74

                      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 63.

                      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