OasisDEX/oasis-react

View on GitHub

Showing 60 of 126 total issues

Function NoConnection has 132 lines of code (exceeds 50 allowed). Consider refactoring.
Open

const NoConnection = () => {
  return (
    <div className={styles.NoEthereumSection}>
      {/*<img className={styles.ImgHeaderLogo} alt="Maker" src={MakerLogo} />*/}
      {/*<hr className={styles.HorizontalLine} />*/}
Severity: Major
Found in src/components/NoConnection.jsx - About 4 hrs to fix

Function healthCheck has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

export const healthCheck = async (
  dispatch,
  getState,
  isInitialHealthcheck = false
) => {
Severity: Minor
Found in src/bootstrap/healthcheck.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 onNetworkCheckEndEpic has 96 lines of code (exceeds 50 allowed). Consider refactoring.
Open

export const onNetworkCheckEndEpic = (
  dispatch,
  getState,
  setInitialSubscriptions,
  accountChanged
Severity: Major
Found in src/store/reducers/network/onNetworkCheckEndEpic.js - About 2 hrs to fix

OasisTakeOfferModalWrapper has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

export class OasisTakeOfferModalWrapper extends PureComponent {
  static takeOfferBtnLabel(offerTakeType, { buyToken, sellToken }) {
    switch (offerTakeType) {
      case TAKE_SELL_OFFER:
        return `Buy ${buyToken}`;
Severity: Minor
Found in src/containers/OasisTakeOfferModal.jsx - About 2 hrs to fix

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

  render() {
    const {
      handleSubmit,
      valid,
      makeTransfer,
Severity: Major
Found in src/containers/TokenTransferForm.jsx - About 2 hrs to fix

Function loadGNTWrapUnwrapsHistoryEpic has 88 lines of code (exceeds 50 allowed). Consider refactoring.
Open

const loadGNTWrapUnwrapsHistoryEpic = (address, config) => async (
  dispatch,
  getState
) => {
  const tokenName = TOKEN_GOLEM;
Severity: Major
Found in src/store/reducers/wrapUnwrapHistory.js - About 2 hrs to fix

SetTokenAllowanceTrustWrapper has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

export class SetTokenAllowanceTrustWrapper extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      isToggleAllowanceTxPending: false
Severity: Minor
Found in src/containers/SetTokenAllowanceTrust.jsx - About 2 hrs to fix

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

  render() {
    const {
      valid,
      handleSubmit,
      initialized,
Severity: Major
Found in src/containers/OasisTokenUnwrapForm.jsx - About 2 hrs to fix

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

  render() {
    const {
      valid,
      handleSubmit,
      unwrappedToken,
Severity: Major
Found in src/containers/OasisTokenWrapForm.jsx - About 2 hrs to fix

Function loadEtherWrapUnwrapsHistoryEpic has 78 lines of code (exceeds 50 allowed). Consider refactoring.
Open

const loadEtherWrapUnwrapsHistoryEpic = (address, config) => async (
  dispatch,
  getState
) => {
  dispatch(loadWrapUnwrapsHistory$.pending());
Severity: Major
Found in src/store/reducers/wrapUnwrapHistory.js - About 2 hrs to fix

Function loadContact has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function loadContact(abi, contractAddress, noProxy) {
  try {
    if (!web3.isAddress(contractAddress)) {
      throw new Error({
        msg: "contract address argument is not an valid ethereum address"
Severity: Minor
Found in src/utils/contracts/loadContract.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

File wrapUnwrap.js has 503 lines of code (exceeds 500 allowed). Consider refactoring.
Open

import { createAction, handleActions } from "redux-actions";
import { fromJS } from "immutable";
import { reset, formValueSelector, change } from "redux-form/immutable";

import {
Severity: Major
Found in src/store/reducers/wrapUnwrap.js - About 2 hrs to fix

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

  render() {
    const {
      offerTakeType,
      sellToken,
      buyToken,
Severity: Major
Found in src/containers/OasisTakeOfferModal.jsx - About 1 hr to fix

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

  render() {
    const { latestBlock: { number } = {} } = this.props;
    return (
      <section className={styles.LockedAccountSection}>
        <div>
Severity: Major
Found in src/components/OasisYourNodeIsSyncing.jsx - About 1 hr to fix

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

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

Function init has 65 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/contracts.js - About 1 hr to fix

Function fetchAndSubscribeUserTradesHistoryEpic has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const fetchAndSubscribeUserTradesHistoryEpic = perActiveTradingPair => (
  dispatch,
  getState
) => {
  if (
Severity: Minor
Found in src/store/reducers/userTrades.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 doHashChange has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export function doHashChange() {
  // For now is the only currency on the left side
  localStorage.setItem('quoteCurrency', 'W-ETH');

  let quoteCurrency = null;
Severity: Minor
Found in src/utils/functions.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 tradeType has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const tradeType = (
  order,
  baseCurrency,
  userToTradeBaseRelation,
  userToTradeAdditionalRelation
Severity: Minor
Found in src/utils/tokens/pair.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 render has 62 lines of code (exceeds 50 allowed). Consider refactoring.
Open

  render() {
    const {
      amount,
      fullPrecisionAmount,
      fullPrecisionUnit,
Severity: Major
Found in src/containers/OasisSignificantDigits.jsx - About 1 hr to fix
Severity
Category
Status
Source
Language