AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

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

const createBuildDir = new Promise((resolve, reject) => {
  const code = shell.exec(`mkdir ${BUILD_DIRECTORY}`).code;

  if (code !== 0) {
    reject(new Error());
Severity: Major
Found in scripts/build.js and 1 other location - About 2 hrs to fix
scripts/build.js on lines 50..59

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

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

  trade: PropTypes.shape({
    numShares: PropTypes.string,
    limitPrice: PropTypes.string,
    tradingFees: PropTypes.object,
    potentialEthProfit: PropTypes.object,
src/modules/market-charts/components/market-outcome-charts--depth/market-outcome-charts--depth.jsx on lines 138..148

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

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

    describe("values", () => {
      test("should exist", () => {
        expect(initialFairPrices.values).toBeDefined();
      });

Severity: Major
Found in src/assertions/common/initial-fair-prices.js and 1 other location - About 2 hrs to fix
src/assertions/common/initial-fair-prices.js on lines 23..31

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

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

    <g
      id="Symbols"
      stroke="none"
      strokeWidth="1"
      fill="none"
Severity: Major
Found in src/modules/common/components/nav-markets-icon.jsx and 1 other location - About 2 hrs to fix
src/modules/common/components/icons.jsx on lines 749..763

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

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

      this.drawCrosshairs({
        hoveredPrice: nextProps.hoveredPrice,
        pricePrecision: nextProps.pricePrecision,
        marketDepth: nextProps.marketDepth,
        yScale: nextState.yScale,
src/modules/trading/components/trading--confirm/trading--confirm.jsx on lines 298..308

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

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

    describe("raw", () => {
      test("should exist", () => {
        expect(initialFairPrices.raw).toBeDefined();
      });

Severity: Major
Found in src/assertions/common/initial-fair-prices.js and 1 other location - About 2 hrs to fix
src/assertions/common/initial-fair-prices.js on lines 13..21

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

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

const removeBuildDir = new Promise((resolve, reject) => {
  const code = shell.exec(`rimraf ${BUILD_DIRECTORY}`).code;

  if (code !== 0) {
    reject(new Error());
Severity: Major
Found in scripts/build.js and 1 other location - About 2 hrs to fix
scripts/build.js on lines 61..70

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

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

export default function(newMarket = DEFAULT_STATE(), action) {
  switch (action.type) {
    case ADD_ORDER_TO_NEW_MARKET: {
      const orderToAdd = action.data.order;
      const { quantity, price, type, orderEstimate, outcome } = orderToAdd;
Severity: Major
Found in src/modules/markets/reducers/new-market.js - About 2 hrs to fix

    Function componentWillUpdate has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      componentWillUpdate(nextProps, nextState) {
        const {
          hoveredPrice,
          marketDepth,
          marketMax,

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

        render() {
          const { description, marketId, location, pricePrecision } = this.props;
          const s = this.state;
      
          return (
      Severity: Major
      Found in src/modules/market/components/market-view/market-view.jsx - About 2 hrs to fix

        Function createLiquidity has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function createLiquidity(orders: Array<LiquidityOrder>) {
          let askOrders: LiquidityChartRows = {};
          let bidOrders: LiquidityChartRows = {};
          let currentOrdersArray;
          for (let order of orders) {
        Severity: Major
        Found in integration/helpers/liquidity.ts - About 2 hrs to fix

          Function reInitAugur has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          export const reInitAugur = history => (dispatch, getState) => {
            const debounceCall = debounce((callback = cb) => {
              const { connection, env } = getState();
              if (!connection.isConnected || !connection.isConnectedToAugurNode) {
                dispatch(
          Severity: Minor
          Found in src/modules/app/actions/re-init-augur.js - About 2 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 MarketOutcomes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          const MarketOutcomes = ({
            outcomes,
            max,
            min,
            type,

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

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

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

              render() {
                const { className, label, options } = this.props;
                const s = this.state;
            
                return (
            Severity: Major
            Found in src/modules/common/components/input-dropdown/input-dropdown.jsx - About 2 hrs to fix

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

                    <InputDropdown
                      label="Minute"
                      options={minutes}
                      default={newMarket.minute}
                      className={Styles.CreateMarketDefine_delay_time_sub}
              src/modules/create-market/components/create-market-form-time/create-market-form-time.jsx on lines 80..88

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

              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

                    <InputDropdown
                      label="Hour"
                      options={hours}
                      default={newMarket.hour}
                      className={Styles.CreateMarketDefine_delay_time_sub}
              src/modules/create-market/components/create-market-form-time/create-market-form-time.jsx on lines 89..97

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

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

              export function formatDate(d) {
                const date = d instanceof Date ? d : new Date(0);
              
                // UTC Time Formatting
                const utcTime = [date.getUTCHours(), date.getUTCMinutes()];
              Severity: Major
              Found in src/utils/format-date.js - About 2 hrs to fix

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

                  render() {
                    const {
                      recipient,
                      unclaimedRep,
                      unclaimedEth,

                  Function listenToUpdates has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const listenToUpdates = history => (dispatch, getState) => {
                    if (!selectUseWebsocketToConnectAugurNode(getState())) return;
                  
                    augur.events.stopBlockListeners();
                    augur.events.stopAugurNodeEventListeners();
                  Severity: Major
                  Found in src/modules/events/actions/listen-to-updates.js - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language