Showing 529 of 1,757 total issues
Function default
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function(fS) {
expect(fS).toBeDefined();
expect(typeof fS).toBe("object");
const sFS = fS.selectedFilterSort;
Function loginWithMetaMask
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const loginWithMetaMask = (callback = logError) => dispatch => {
const failure = () => callback("NOT_SIGNED_IN");
const success = account => {
// make sure we actually have an account before succeeding...
if (!account) return failure();
Function selectTransactions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
transactionsData => {
const tradeGroups = [];
const formattedTransactions = Object.keys(transactionsData || {})
.reduce((p, id) => {
const { tradeGroupId } = transactionsData[id];
Function loadUnclaimedFees
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const loadUnclaimedFees = (marketIds = [], callback = logError) => (
dispatch,
getState
) => {
if (marketIds == null || marketIds.length === 0) return callback(null, []);
Function getOrderBookKeys
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getOrderBookKeys = memoize((marketDepth, minPrice, maxPrice) => {
let min = marketDepth[BIDS].reduce((p, order, i) => {
if (i === 0) return order[1];
return order[1] < p ? order[1] : p;
}, null);
Function AccountView
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const AccountView = p => {
const showRepFaucet = parseInt(augur.rpc.getNetworkID(), 10) !== 1;
return (
<section className={Styles.AccountView}>
Function default
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
numShares,
limitPrice,
side,
minPrice,
maxPrice,
Function callbackTests
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const callbackTests = asset => {
t.asset = asset;
beforeEach(() => {
updateLoginAccountSpy = jest
Function ledgerSigner
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ledgerSigner = async (rawTxArgs, ledgerLib, derivationPath, dispatch) => {
dispatch(
updateModal({
type: MODAL_LEDGER
})
Function addNewMarketCreationTransactions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function addNewMarketCreationTransactions(market) {
return (dispatch, getState) => {
const marketCreationData = {};
const { loginAccount } = getState();
const transaction = {
Function componentWillMount
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
componentWillMount() {
const ClaimReportingFeesForkedMarketOptions = {
forkedMarket: this.props.forkedMarket,
estimateGas: true,
onSent: () => {},
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(props) {
super(props);
const etherGasCost = formatEtherEstimate(
formatGasCostToEther(
Function selectBucketedPriceTimeSeries
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const selectBucketedPriceTimeSeries = (
creationTime,
currentTimestamp,
outcomes
) => {
Function default
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function() {
const positionsSummary = generateMarketsPositionsSummary(selectAllMarkets());
const marketsSummary = selectMarketsSummary();
const totalValue = formatEther(
Function wrapLogHandler
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
) => (err, log) => {
if (err) return console.error((log || {}).eventName, err, log);
if (log) {
// console.info(`${new Date().toISOString()} LOG ${log.removed ? 'REMOVED' : 'ADDED'} ${log.eventName} ${JSON.stringify(log)}`)
const universeId = getState().universe.id;
Function buildSearchString
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const buildSearchString = (keywords, tags) => {
const MIN_KEYWORDS_LENGTH = 1;
const propertyTranslation = [
{ find: "title:", replace: "shortDescription:" },
{ find: "details:", replace: "longDescription:" },
Function selectInfoNotificationsAndSeenCount
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
notifications => {
const networkId = augur.rpc.getNetworkID();
const { universe } = store.getState();
let filteredNotifications = notifications;
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
fixedPrecision,
pricePrecision,
hoveredDepth,
Function testPrice
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
testPrice(value, errors, isOrderValid, nextProps = null) {
const props = nextProps || this.props;
const { maxPrice, minPrice, market } = props;
const tickSize = createBigNumber(market.tickSize);
let errorCount = 0;
Function useUnlockedAccount
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
export const useUnlockedAccount = (
unlockedAddress,
callback = logError
) => dispatch => {
if (unlockedAddress == null) return callback("no account address");
- Read upRead up
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"