AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

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

  const utils4 = [
    {
      func: "formatEther",
      denom: "ETH",
      out: {
Severity: Major
Found in src/utils/format-number.test.js and 3 other locations - About 4 hrs to fix
src/utils/format-number.test.js on lines 125..156
src/utils/format-number.test.js on lines 169..200
src/utils/format-number.test.js on lines 257..288

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

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

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

  render() {
    const {
      currentTimeInSeconds,
      outcomeName,
      hasOrders,

    Function handleRelayTransaction has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

    export const handleRelayTransaction = tx => (dispatch, getState) => {
      if (tx && tx.response && tx.data) {
        const { hash, type } = tx;
        if (!hash) return console.error("uncaught relayed transaction", tx);
        const { loginAccount, transactionsData } = getState();
    Severity: Minor
    Found in src/modules/transactions/actions/register-transaction-relay.js - About 4 hrs 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 121 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const { isLogged, edgeLoading } = this.props;
        const s = this.state;
    
        return (
    Severity: Major
    Found in src/modules/auth/components/connect-dropdown/connect-dropdown.jsx - About 4 hrs to fix

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

        render() {
          const {
            collectMarketCreatorFees,
            loadMarketsInfoIfNotLoaded,
            history,
      Severity: Major
      Found in src/modules/portfolio/components/markets/markets.jsx - About 4 hrs to fix

        Function startOrderSending has 120 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const startOrderSending = options => (dispatch, getState) => {
          const { marketId } = options;
          const { loginAccount, marketsData, pendingLiquidityOrders } = getState();
          const bnAllowance = createBigNumber(loginAccount.allowance, 10);
          const market = marketsData[marketId];
        Severity: Major
        Found in src/modules/orders/actions/liquidity-management.js - About 4 hrs to fix

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

            render() {
              const {
                clearSelectedOutcome,
                description,
                history,
          Severity: Major
          Found in src/modules/market/components/market-header/market-header.jsx - About 4 hrs to fix

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

              render() {
                const {
                  history,
                  isForking,
                  isMobile,
            Severity: Major
            Found in src/modules/reporting/components/common/disputing-markets.jsx - About 4 hrs to fix

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

                  test("Processed token mint log when address does not match.", () => {
                    isCurrentMarketSpy = jest
                      .spyOn(isCurrentMarketModule, "isCurrentMarket")
                      .mockImplementation(() => false);
                    store = configureMockStore([thunk])({
              Severity: Major
              Found in src/modules/events/actions/log-handlers.test.js and 1 other location - About 4 hrs to fix
              src/modules/events/actions/log-handlers.test.js on lines 128..145

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

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

                  test("Didn't fire off update and load account trades if the sell complete set log doesn't include the account address.", () => {
                    isCurrentMarketSpy = jest
                      .spyOn(isCurrentMarketModule, "isCurrentMarket")
                      .mockImplementation(() => false);
                    store = configureMockStore([thunk])({
              Severity: Major
              Found in src/modules/events/actions/log-handlers.test.js and 1 other location - About 4 hrs to fix
              src/modules/events/actions/log-handlers.test.js on lines 169..186

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

              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

              File load-universe-info.js has 360 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { augur } from "services/augurjs";
              import { UNIVERSE_ID } from "modules/app/constants/network";
              import logError from "utils/log-error";
              import async from "async";
              import { createBigNumber } from "utils/create-big-number";
              Severity: Minor
              Found in src/modules/universe/actions/load-universe-info.js - About 4 hrs to fix

                File market.js has 360 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import assertFormattedNumber from "src/assertions/common/formatted-number";
                import assertFormattedDate from "src/assertions/common/formatted-date";
                import assertReportableOutcomes from "src/assertions/reportable-outcomes";
                
                export default function(market) {
                Severity: Minor
                Found in src/assertions/market.js - About 4 hrs to fix

                  Function outcomes has 116 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                            .map(outcomeId => {
                              const outcomeData = marketOutcomesData[outcomeId];
                              const outcomeTradeInProgress =
                                marketTradeInProgress && marketTradeInProgress[outcomeId];
                              const volume = createBigNumber(outcomeData.volume);
                  Severity: Major
                  Found in src/modules/markets/selectors/market.js - About 4 hrs to fix

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

                            <span className={StylesHeader.MarketOutcomeChartsHeader__stat}>
                              <span
                                className={StylesHeader[`MarketOutcomeChartsHeader__stat-title`]}
                              >
                                {isMobile ? "h" : "high"}
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 35..50
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 51..66
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 83..98
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 99..114

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

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

                            <span className={StylesHeader.MarketOutcomeChartsHeader__stat}>
                              <span
                                className={StylesHeader[`MarketOutcomeChartsHeader__stat-title`]}
                              >
                                {isMobile ? "o" : "open"}
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 35..50
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 67..82
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 83..98
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 99..114

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

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

                            <span className={StylesHeader.MarketOutcomeChartsHeader__stat}>
                              <span
                                className={StylesHeader[`MarketOutcomeChartsHeader__stat-title`]}
                              >
                                {isMobile ? "l" : "low"}
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 35..50
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 51..66
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 67..82
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 99..114

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

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

                            <span className={StylesHeader.MarketOutcomeChartsHeader__stat}>
                              <span
                                className={StylesHeader[`MarketOutcomeChartsHeader__stat-title`]}
                              >
                                {isMobile ? "v" : "volume"}
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 51..66
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 67..82
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 83..98
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 99..114

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

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

                            <span className={StylesHeader.MarketOutcomeChartsHeader__stat}>
                              <span
                                className={StylesHeader[`MarketOutcomeChartsHeader__stat-title`]}
                              >
                                {isMobile ? "c" : "close"}
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 35..50
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 51..66
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 67..82
                    src/modules/market-charts/components/market-outcome-charts--header-candlestick/market-outcome-charts--header-candlestick.jsx on lines 83..98

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

                    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

                    Function setCurrentSegment has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                    Open

                      setCurrentSegment(options) {
                        if (!options.itemsLength) return options.setSegment([]);
                    
                        const currentPage = parseInt(
                          parseQuery(options.location.search)[options.pageParam] || 1,
                    Severity: Minor
                    Found in src/modules/common/components/paginator/paginator.jsx - About 4 hrs 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

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

                      describe("current time is before interval", () => {
                        test("should clamp percentages 0", () => {
                          const wrapper = shallow(
                            <Cmp
                              startDate={startTimeAsDate}
                    src/modules/market/components/common/time-remaining-indicator/time-remaining-indicator.test.jsx on lines 25..39

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

                    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