OasisDEX/oasis-react

View on GitHub

Showing 60 of 126 total issues

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

  render() {
    const { transaction } = this.props;
    switch (transaction.get("txStatus")) {
      case TX_STATUS_AWAITING_USER_ACCEPTANCE:
        return (
Severity: Major
Found in src/components/TransactionStatus.jsx - About 1 hr to fix

Function healthCheck has 59 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export const healthCheck = async (
  dispatch,
  getState,
  isInitialHealthcheck = false
) => {
Severity: Major
Found in src/bootstrap/healthcheck.js - About 1 hr to fix

Function init has 59 lines of code (exceeds 50 allowed). Consider refactoring.
Open

const init = networkName => {
  const tokencontractsDeploymentAdressessList = config["tokens"][networkName];
  const marketDeploymentAddress = config["market"][networkName]["address"];

  const WETH = loadContact(
Severity: Major
Found in src/bootstrap/__mocks__/contracts.js - About 1 hr to fix

Function depthChartData has 56 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  (bids, asks) => {
    const askPrices = _.sortedUniq(asks.map(ask => ask.ask_price_sort));
    const askGroups = groupBy(asks, ask => ask.ask_price_sort);
    const askAmounts = {
      quote: upSum(askGroups.map(group => bigSum(group.map(ask => ask.buyHowMuch.toString())))),
Severity: Major
Found in src/store/selectors/charts.js - About 1 hr to fix

Function render has 56 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  render() {
    const { baseToken, offerMakeType, sellToken } = this.props;

    return (
      <ReactModal
Severity: Major
Found in src/containers/OasisMakeOfferModal.jsx - About 1 hr to fix

Function render has 55 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  render() {
    const {
      activeTradingPair: { baseToken, quoteToken },
      hasSufficientTokenAmount,
      // canMakeOffer,
Severity: Major
Found in src/containers/OasisMakeSellOffer.jsx - About 1 hr to fix

Function setMaxButton has 54 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  setMaxButton() {

    if (false === this.state.showMaxButton) {
      return null;
    }
Severity: Major
Found in src/components/OfferTakeForm.jsx - About 1 hr to fix

Function render has 53 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  render() {
    const {
      tokenTrades,
      initialMarketHistoryLoaded,
      activeTradingPair,
Severity: Major
Found in src/containers/OasisTradeOrders.jsx - About 1 hr to fix

Function depthChartData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  (bids, asks) => {
    const askPrices = _.sortedUniq(asks.map(ask => ask.ask_price_sort));
    const askGroups = groupBy(asks, ask => ask.ask_price_sort);
    const askAmounts = {
      quote: upSum(askGroups.map(group => bigSum(group.map(ask => ask.buyHowMuch.toString())))),
Severity: Minor
Found in src/store/selectors/charts.js - About 1 hr 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 validateEthereumAddress has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  validateEthereumAddress(value) {
    const { onValidityChange } = this.props;
    if (this.props.required) {
      if (!value) {
        return VALIDATION_VALUE_IS_REQUIRED;
Severity: Minor
Found in src/containers/EthereumAddressInputField.jsx - About 1 hr 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 checkAccountsEpic has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const checkAccountsEpic = () => async (dispatch, getState) => {
  const userAccounts = (await dispatch(checkAccounts())).value;
  const isMetamaskLocked = getState().getIn(['platform', 'accountLocked']);
  const hasUserAccounts = userAccounts.length;
  if(!hasUserAccounts) {
Severity: Minor
Found in src/store/reducers/accounts.js - About 1 hr 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 getNewOfferRankIndex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  (
    offerFormName,
    currentFormValues,
    currentTradingPairOffersData = fromJS({ buyOffers: [], sellOffers: [] })
  ) => {
Severity: Minor
Found in src/store/selectors/offerMakes.js - About 1 hr 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 setMaxButton has 52 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  setMaxButton() {
    if (false === this.state.showMaxButton) {
      return null;
    }
    const {
Severity: Major
Found in src/containers/OasisOfferMakeForm.jsx - About 1 hr to fix

Function bootstrap has 52 lines of code (exceeds 50 allowed). Consider refactoring.
Open

const bootstrap = async () => {
  const { dispatch, getState } = store;
  period.init(getState);
  conversion.init(getState);

Severity: Major
Found in src/index.js - About 1 hr to fix

Function render has 51 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  render() {
    const {
      activeTradingPair: { baseToken, quoteToken },
      hasSufficientTokenAmount,
      isTotalOverTheTokenMax,
Severity: Major
Found in src/containers/OasisMakeBuyOffer.jsx - About 1 hr to fix

Function render has 51 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  render() {
    return (
      <Line
        height={CHART_HEIGHT}
        data={{
Severity: Major
Found in src/components/OasisChartPrice.jsx - About 1 hr to fix

Function render has 51 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  render() {
    const {
      baseToken,
      quoteToken,
      handleSubmit,
Severity: Major
Found in src/containers/OasisOfferMakeForm.jsx - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

    if (transactionActionResult) {
      const txStartTimestamp = getTimestamp();
      const transactionHash = transactionActionResult.value;
      onTransactionPending &&
        onTransactionPending({
Severity: Major
Found in src/utils/transactions/handleTransaction.js - About 1 hr to fix

Function parseAndSyncOffersPage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const parseAndSyncOffersPage = (
  rawOffersPayload,
  { dispatch, sellToken, buyToken },
  {
    pageSize = PAGE_SIZE,
Severity: Minor
Found in src/store/reducers/offers/loadOffers.js - About 55 mins 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 setActiveTradingPairEpic has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const setActiveTradingPairEpic = (args, sync = true) => (
  dispatch,
  getState
) => {
  const previousActiveTradingPair = tokens.activeTradingPair(getState());
Severity: Minor
Found in src/store/reducers/tokens.js - About 55 mins 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

Severity
Category
Status
Source
Language