Showing 529 of 1,757 total issues
Function loadUniverse
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const loadUniverse = (universeId, history, callback = logError) => (
dispatch,
getState
) => {
const universePayload = { tx: { to: universeId } };
Function sendOrder
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const sendOrder = () => {
augur.api.CreateOrder.publicCreateOrder({
meta: loginAccount.meta,
tx: { value: augur.utils.convertBigNumberToHexString(cost) },
_type: orderType,
Function mapStateToProps
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const mapStateToProps = (state, ownProps) => {
const market = selectMarket(ownProps.marketId);
let openOrders = [];
let positions = [];
Function mapStateToProps
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const mapStateToProps = (state, ownProps) => {
const { newMarket, loginAccount } = state;
const selectedOutcome = ownProps.selectedOutcome.toString();
const orderBook = formatOrderbook(newMarket.orderBook[selectedOutcome] || []);
Function render
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { location } = this.props;
const s = this.state;
return (
Function changeMenu
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
changeMenu(nextBasePath) {
const { isLogged } = this.props;
const oldType = this.state.currentInnerNavType
? navTypes[this.state.currentBasePath]
: this.state.currentInnerNavType;
Function loadOneOutcomeBidsOrAsks
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
) => (dispatch, getState) => {
const { marketsData } = getState();
if (marketId == null || outcome == null || orderTypeLabel == null) {
return callback(
`must specify market ID, outcome, and order type: ${marketId} ${outcome} ${orderTypeLabel}`
Function cancelOpenOrdersInClosedMarkets
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const cancelOpenOrdersInClosedMarkets = () => dispatch => {
const openOrders = getOpenOrders();
if (openOrders && openOrders.length) {
const numMarketsWithOpenOrders = openOrders.length;
for (let i = 0; i < numMarketsWithOpenOrders; ++i) {
Function loadDisputing
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const loadDisputing = (callback = logError) => (dispatch, getState) => {
const { universe } = getState();
const args = {
sortBy: "endTime",
isSortDescending: false,
Function loadUserTradingHistory
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function loadUserTradingHistory(options = {}, callback = logError) {
return (dispatch, getState) => {
const { universe, loginAccount } = getState();
if (loginAccount.address == null) return callback(null);
if (options.marketId == null) dispatch(clearAccountTrades());
Function mergeProps
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const mergeProps = (sP, dP, oP) => {
const marketId = parseQuery(oP.location.search)[MARKET_ID_PARAM_NAME];
const market = selectMarket(marketId);
let returnPath = parseQuery(oP.location.search)[RETURN_PARAM_NAME];
if (returnPath && returnPath.substring(0, 3) === "#!/") {
Function validateScalar
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
validateScalar(validations, value, humanName, min, max, tickSize, isInvalid) {
const { updateState } = this.props;
const updatedValidations = { ...validations };
this.setState({ activeButton: ReportingReportForm.BUTTONS.SCALAR_VALUE });
const minValue = parseFloat(min);
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { transaction } = this.props;
const s = this.state;
return (
Function default
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function(
pendingLiquidityOrders = DEFAULT_STATE(),
{ type, data }
) {
switch (type) {
- 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"
Further reading
Function localStorageMiddleware
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
const localStorageMiddleware = store => next => action => {
next(action);
const state = store.getState();
if (!state || !state.loginAccount || !state.loginAccount.address) {
return;
- 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"
Further reading
Function addReportingTransactions
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function addReportingTransactions(reports) {
return (dispatch, getState) => {
const { marketsData } = getState();
const transactions = {};
eachOf(reports, (reports, universe) => {
Function generateTradeOrders
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(market, outcome, outcomeTradeInProgress) => {
const tradeActions =
outcomeTradeInProgress && outcomeTradeInProgress.tradeActions;
if (
!market ||
Function toggleMenuTween
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
toggleMenuTween(menuKey, forceOpen, cb) {
if (getValue(this.state[menuKey], "currentTween.stop"))
this.state[menuKey].currentTween.stop();
let nowOpen = !this.state[menuKey].open;
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const s = this.state;
const { transaction } = this.props;
return (
Function pollForNetwork
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function pollForNetwork(dispatch, getState) {
setInterval(() => {
const { modal } = getState();
dispatch(
verifyMatchingNetworkIds((err, expectedNetworkId) => {