Showing 529 of 1,757 total issues
Function attachHoverClickHandlers
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function attachHoverClickHandlers(options) {
const {
drawParams,
depthChart,
marketDepth,
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { openOrders, outcome, positions } = this.props;
const s = this.state;
return (
Function getReportingFees
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getReportingFees = (callback = logError) => (
dispatch,
getState
) => {
const { universe, loginAccount } = getState();
Function validateScalar
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
validateScalar(value, humanName, min, max, tickSize, isInvalid) {
const { updateState, validations } = this.props;
const updatedValidations = { ...validations };
const { inputRepAmount } = this.state;
Function selectTransactionsTotalsCreator
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
export const selectTransactionsTotalsCreator = () =>
createSelector(selectTransactions, transactions => {
const o = {
numWorking: 0,
numPending: 0,
- 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 render
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
const {
market,
currentTimestamp,
tentativeWinner,
- 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 mergeProps
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const mergeProps = (sP, dP, oP) => {
const { marketId, cb } = sP.modal;
const market = selectMarket(marketId);
const { description, outstandingReturns } = market;
const { gasCost } = sP;
Function assertMyMarkets
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function assertMyMarkets(market) {
describe(`myMarket's shape`, () => {
test("id", () => {
expect(market.id).toBeDefined();
expect(typeof market.id).toBe("string");
Function getMainMenuData
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getMainMenuData() {
const { currentBasePath } = this.props;
return [
{
label: "Positions",
Function orderAndAssignCumulativeShares
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(orderBook, userOpenOrders, loginAccount) => {
const rawBids = ((orderBook || {})[BIDS] || []).slice();
const bids = rawBids.sort((a, b) => b.price.value - a.price.value).reduce(
(p, order, i, orders) => [
...p,
Function validateType
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
validateType(value) {
const { isValid, newMarket, updateNewMarket } = this.props;
const updatedMarket = { ...newMarket };
const validations = updatedMarket.validations[newMarket.currentStep];
Function validateTag
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
validateTag(fieldName, value, maxLength, isRequired = true) {
const { isValid, newMarket, updateNewMarket } = this.props;
const { currentStep } = newMarket;
const { localValues } = this.state;
const updatedMarket = { ...newMarket };
Function calculateMarketCreationCosts
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
calculateMarketCreationCosts() {
const { meta, universe, newMarket, gasPrice } = this.props;
augur.createMarket.getMarketCreationCostBreakdown(
{ universe: universe.id, meta },
Function componentWillReceiveProps
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
componentWillReceiveProps(nextProps, nextState) {
const { newMarket, gasPrice } = this.props;
if (
newMarket.initialLiquidityEth !== nextProps.newMarket.initialLiquidityEth
)
Function loadAccountOrders
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const loadAccountOrders = (options = {}, callback = logError) => (
dispatch,
getState
) => {
const { universe, loginAccount } = getState();
Function withdrawReview
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
withdrawReview() {
const { withdrawReviewModal, closeModal } = this.props;
const s = this.state;
if (s.isValid) {
withdrawReviewModal({
Function CreateMarketLiquidityOrders
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CreateMarketLiquidityOrders = props => {
const { newMarket, liquidityState, removeOrderFromNewMarket } = props;
const defaultOutcome = newMarket.type !== CATEGORICAL ? 1 : "";
const selectedOutcome =
liquidityState && liquidityState.selectedOutcome
Consider simplifying this complex logical expression. Open
Open
if (
!isEqual(marketDepth, nextProps.marketDepth) ||
!isEqual(orderBookKeys, nextProps.orderBookKeys) ||
!isEqual(sharedChartMargins, nextProps.sharedChartMargins) ||
!isEqual(updateHoveredPrice, nextProps.updateHoveredPrice) ||
Function mapStateToProps
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const mapStateToProps = state => {
const positions = getLoginAccountPositions();
const openOrders = getOpenOrders();
const orphanedOrders = selectOrphanOrders(state);
const orphanedMarkets = [];
Function getUniverseInfo
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getUniverseInfo(universeId, callback) {
const universeData = {
id: universeId,
reportableOutcomes: null,
winningChildUniverseId: null,