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

export const toReporting = async () => {
  const url = `${process.env.AUGUR_URL}`;
  await page.goto(url.concat("#/reporting-report-markets"));
};
Severity: Major
Found in integration/helpers/navigation-helper.ts and 3 other locations - About 1 hr to fix
integration/helpers/navigation-helper.ts on lines 16..19
integration/helpers/navigation-helper.ts on lines 21..24
integration/helpers/navigation-helper.ts on lines 46..49

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

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

export const toPortfolio = async () => {
  const url = `${process.env.AUGUR_URL}`;
  await page.goto(url.concat("#/my-positions"));
};
Severity: Major
Found in integration/helpers/navigation-helper.ts and 3 other locations - About 1 hr to fix
integration/helpers/navigation-helper.ts on lines 21..24
integration/helpers/navigation-helper.ts on lines 26..29
integration/helpers/navigation-helper.ts on lines 46..49

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

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 handleRelayTransaction has 31 lines of code (exceeds 25 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 1 hr to fix

    Function toggleTag has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const toggleTag = (tag, location, history) => () => {
      let searchParams = parseQuery(location.search);
    
      if (
        searchParams[TAGS_PARAM_NAME] == null ||
    Severity: Minor
    Found in src/modules/routes/helpers/toggle-tag.js - About 1 hr to fix

      Function formatGroupedTransactions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function formatGroupedTransactions(transactions) {
        const formattedTransactions = transactions
          .map(transaction => formatTransaction(transaction))
          .sort(
            (a, b) =>
      Severity: Minor
      Found in src/modules/transactions/selectors/transactions.js - About 1 hr to fix

        Function default has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function(outcomesData = DEFAULT_STATE, action) {
          switch (action.type) {
            case UPDATE_MARKETS_DATA:
              return {
                ...outcomesData,
        Severity: Minor
        Found in src/modules/markets/reducers/outcomes-data.js - About 1 hr to fix

          Function onDerivationPathChange has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static async onDerivationPathChange(derivationPaths, pageNumber = 1) {
              const transport = await TransportU2F.create();
              const ledgerEthereum = new Eth(transport);
              const appConfiguration = await ledgerEthereum.getAppConfiguration();
              if (!appConfiguration.arbitraryDataEnabled) {
          Severity: Minor
          Found in src/modules/auth/components/ledger-connect/ledger-connect.jsx - About 1 hr to fix

            Function constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              constructor(props) {
                super(props);
                const { transactionPeriod } = props;
                this.state = {
                  lowerBound: null,
            Severity: Minor
            Found in src/modules/portfolio/components/transactions/transactions.jsx - About 1 hr to fix

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

                render() {
                  const { userDefinedGasPrice, gasPriceSpeed, className } = this.props;
              
                  return (
                    <div className={classNames(Styles.GasPriceEdit, className)}>
              Severity: Minor
              Found in src/modules/app/components/gas-price-edit/gas-price-edit.jsx - About 1 hr to fix

                Function constructor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  constructor(props) {
                    super(props);
                
                    this.snapConfig = {
                      scrollSnapDestination: "100% 0%",

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

                    render() {
                      const { id, unclaimedCreatorFees, collectMarketCreatorFees } = this.props;
                  
                      return (
                        <div className={Styles.MarketOutstandingReturns}>

                    Function createScalarMarket has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const createScalarMarket = async () => {
                      // page.on('console', msg => console.log('PAGE LOG:', msg.text()));
                      const currentTimestamp: number = await page.evaluate(() =>
                        window.integrationHelpers.getCurrentTimestamp()
                      );
                    Severity: Minor
                    Found in integration/helpers/create-markets.ts - About 1 hr to fix

                      Function createPeriodPLSelector has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          (accountTrades, blockchain, outcomesData, currentTimestamp) => {
                            if (!accountTrades || !blockchain) return null;
                      
                            const periodDate = new Date(
                              currentTimestamp - period * 24 * 60 * 60 * 1000
                      Severity: Minor
                      Found in src/modules/account/selectors/core-stats.js - About 1 hr to fix

                        Function RewriteUrlParams has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const RewriteUrlParams = windowRef => BaseCmp => {
                          const WrapperCmp = props => {
                            const { location } = props;
                            const searchValues = parseQuery(location.search);
                        
                        
                        Severity: Minor
                        Found in src/modules/app/hocs/rewrite-url-params/index.jsx - About 1 hr to fix

                          Function componentWillReceiveProps has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            componentWillReceiveProps(nextProps) {
                              const { isMobile, location, universe, blockchain } = this.props;
                              if (isMobile !== nextProps.isMobile) {
                                this.setState({
                                  mobileMenuState: mobileMenuStates.CLOSED
                          Severity: Minor
                          Found in src/modules/app/components/app/app.jsx - About 1 hr to fix

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

                                    test(`market.outcomes[${i}].userOpenOrders`, () => {
                                      expect(userOpenOrders).toBeDefined();
                                      expect(Array.isArray(userOpenOrders)).toBe(true);
                                    });
                            Severity: Major
                            Found in src/assertions/market.js and 1 other location - About 1 hr to fix
                            src/assertions/market.js on lines 201..204

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

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

                                const actual = buildCreateMarket(
                                  store.getState().newMarket,
                                  false,
                                  store.getState().universe,
                                  store.getState().loginAccount,
                            Severity: Major
                            Found in src/modules/markets/helpers/build-create-market.test.js and 2 other locations - About 1 hr to fix
                            src/modules/markets/helpers/build-create-market.test.js on lines 122..128
                            src/modules/markets/helpers/build-create-market.test.js on lines 184..190

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

                            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

                              hideReadMore(e) {
                                if (this.readMore && !this.readMore.contains(event.target)) {
                                  this.setState({ readMore: false });
                                }
                              }
                            src/modules/common/components/dropdown/dropdown.jsx on lines 49..53
                            src/modules/market-charts/components/market-outcome-charts--candlestick-period-selector/market-outcome-charts--candlestick-period-selector.jsx on lines 40..44

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

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

                                const actual = buildCreateMarket(
                                  store.getState().newMarket,
                                  false,
                                  store.getState().universe,
                                  store.getState().loginAccount,
                            Severity: Major
                            Found in src/modules/markets/helpers/build-create-market.test.js and 2 other locations - About 1 hr to fix
                            src/modules/markets/helpers/build-create-market.test.js on lines 60..66
                            src/modules/markets/helpers/build-create-market.test.js on lines 122..128

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

                            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

                              test(`should call the expected method`, () => {
                                const market = {
                                  reportingState: constants.REPORTING_STATE.CROWDSOURCING_DISPUTE
                                };
                                expect(determineMarketLinkType(market, account)).toEqual(TYPE_DISPUTE);
                            src/modules/markets/helpers/determine-market-link-type.test.js on lines 28..33
                            src/modules/markets/helpers/determine-market-link-type.test.js on lines 51..56

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

                            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