AugurProject/augur-ui

View on GitHub

Showing 529 of 1,757 total issues

Function determineDrawParams has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function determineDrawParams({
  containerHeight,
  containerWidth,
  currentTimeInSeconds,
  marketMax,

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

  componentWillReceiveProps(nextProps, nextState) {
    const { newMarket, gasPrice } = this.props;
    if (
      newMarket.initialLiquidityEth !== nextProps.newMarket.initialLiquidityEth
    )

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

  render() {
    const p = this.props;
    const {
      marketType,
      openInterest,

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

const MarketPreviewRange = ({ newMarket }) => {
  let minValue = "0%";
  let maxValue = "100%";

  const { scalarSmallNum, scalarBigNum, type } = newMarket;

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

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

                              getFundsString(testWithLiquidity = false) {
                                const { availableEth, availableRep } = this.props;
                                const s = this.state;
                                let insufficientFundsString = "";
                            
                            

                              Function reduceSharesCountByPrice has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function reduceSharesCountByPrice(aggregateOrdersPerPrice, order) {
                                if (
                                  order &&
                                  !isNaN(order.fullPrecisionPrice) &&
                                  !isNaN(order.fullPrecisionAmount)
                              Severity: Minor
                              Found in src/modules/orders/helpers/select-order-book.js - About 1 hr to fix

                                Function selectTransactionsTotalsCreator has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  createSelector(selectTransactions, transactions => {
                                    const o = {
                                      numWorking: 0,
                                      numPending: 0,
                                      numComplete: 0,
                                Severity: Minor
                                Found in src/modules/transactions/selectors/transactions-totals.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language