Showing 60 of 126 total issues
Function subscribeAccountEthBalanceChangeEventEpic
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const subscribeAccountEthBalanceChangeEventEpic = accountAddress => async (
dispatch,
getState
) => {
dispatch(subscribeAccountEthBalanceChangeEvent.pending());
- Read upRead up
- Create a ticketCreate a ticket
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 redirect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
redirect() {
const params = this.props.match.params;
const { baseToken, quoteToken } = this.props.defaultTradingPair.toJSON();
if (!validateTradingPair(params.baseToken, params.quoteToken, generateTradingPairs(BASE_TOKENS, QUOTE_TOKENS))) {
- Read upRead up
- Create a ticketCreate a ticket
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 subscribeLatestBlockFilterEpic
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const subscribeLatestBlockFilterEpic = () => async (
dispatch,
getState
) => {
dispatch(subscribeLatestBlockFilter.pending());
- Read upRead up
- Create a ticketCreate a ticket
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
Consider simplifying this complex logical expression. Open
if (
isVolumeOrPriceEmptyOrZero(offerMakeType) ||
!hasSufficientTokenAmount(offerMakeType) ||
// !canSendTransaction ||
!isBuyEnabled ||
- Create a ticketCreate a ticket
Function asToken
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function asToken(addressOrToken, defaultToken) {
const allTokens = Dapple.getTokens();
if (!defaultToken
|| typeof defaultToken !== 'string'
- Read upRead up
- Create a ticketCreate a ticket
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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const onNetworkCheckEndEpic = (
dispatch,
getState,
setInitialSubscriptions,
accountChanged
- Read upRead up
- Create a ticketCreate a ticket
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 activeWrappedTokenBalance
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
(wub, activeWrappedToken, asBN = true) => {
if (!activeWrappedToken) {
return null;
} else if (wub) {
const balances = wub.find(
- Read upRead up
- Create a ticketCreate a ticket
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 tokenBalanceMemo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
s => memoize((tokenName, balanceUnit = ETH_UNIT_ETHER, toBigNumber = true) => {
const tokenBalance = s.get(tokenName);
if (tokenBalance) {
if (toBigNumber) {
return web3.fromWei(new BigNumber(s.get(tokenName), 10), balanceUnit);
- Read upRead up
- Create a ticketCreate a ticket
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 7 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { order, baseCurrency, type, userToTradeBaseRelation, userToTradeAdditionalRelation } = this.props;
const tradeTypeEnum =
type || tradeType(order, baseCurrency, userToTradeBaseRelation, userToTradeAdditionalRelation);
- Read upRead up
- Create a ticketCreate a ticket
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 setWrapMax
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const setWrapMax = () => (dispatch, getState) => {
const activeUnwrappedToken = wrapUnwrap.activeUnwrappedToken(getState());
const maxWrapValueInEther =
activeUnwrappedToken === TOKEN_ETHER
? web3.fromWei(balances.ethBalance(getState()))
- Read upRead up
- Create a ticketCreate a ticket
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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
setMaxButton() {
if (false === this.state.showMaxButton) {
return null;
}
- Read upRead up
- Create a ticketCreate a ticket
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 transformRow
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
transformRow(row) {
const { marketData = List(), initialMarketHistoryLoaded } = this.props;
const [baseToken, quoteToken] = [row.get("base"), row.get("quote")];
const pair = (
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid too many return
statements within this function. Open
return (
<div className={classes({ isAppLoading, globalFormLock })}>
<BrowserRouter>{this.mainContent()}</BrowserRouter>
<div>{OasisAppWrapper.versionInfo()}</div>
</div>
- Create a ticketCreate a ticket
Function removeOutliersFromArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function removeOutliersFromArray(data, fieldName, deviation) {
const l = data.length;
if (data.length <= 2) {
return data;
}
- Read upRead up
- Create a ticketCreate a ticket
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 LoadProgressSection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const LoadProgressSection = ({
loadedOffersList,
offersTotalCount,
showPercent
}) => {
- Read upRead up
- Create a ticketCreate a ticket
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 isOfferBelowLimit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(tokenMinSellLimitInWeiByOfferType, currentFormValues) => memoize(offerMakeType => {
const { total, volume } = currentFormValues(offerMakeToFormName(offerMakeType));
const tokenMinSellLimitInWei = tokenMinSellLimitInWeiByOfferType(offerMakeType);
if (tokenMinSellLimitInWei === null) {
return null;
- Read upRead up
- Create a ticketCreate a ticket
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 activeUnwrappedTokenBalance
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(wub, activeUnwrappedToken, asBN = true) => {
if (!activeUnwrappedToken) {
return null;
} else {
const balance = wub
- Read upRead up
- Create a ticketCreate a ticket
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 loadTokenTransfersHistoryEpic
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const loadTokenTransfersHistoryEpic = (tokenName, address, config) => async (
dispatch,
getState
) => {
const defaultAccount = accounts.defaultAccount(getState());
- Read upRead up
- Create a ticketCreate a ticket
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 isVolumeGreaterThanOfferMax
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(volume, offerData, offerTakeType) => {
if (!offerData) {
return false;
}
const buyHowMuch = web3.fromWei(offerData.get("buyHowMuch"));
- Read upRead up
- Create a ticketCreate a ticket
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"