Showing 1,757 of 1,757 total issues
Function CreateMarketLiquidityOrders
has 42 lines of code (exceeds 25 allowed). Consider refactoring. 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
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
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
function getUniverseInfo(universeId, callback) {
const universeData = {
id: universeId,
reportableOutcomes: null,
winningChildUniverseId: null,
Function loadUniverse
has 41 lines of code (exceeds 25 allowed). Consider refactoring. 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
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
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
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
render() {
const { location } = this.props;
const s = this.state;
return (
Function changeMenu
has 41 lines of code (exceeds 25 allowed). Consider refactoring. 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
) => (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
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
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
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
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
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
render() {
const { transaction } = this.props;
const s = this.state;
return (
Similar blocks of code found in 3 locations. Consider refactoring. Open
export const updateOrderBook = ({
marketId,
outcome,
orderTypeLabel,
orderBook
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 67.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
module.exports = {
name: "integration",
displayName: "Integration Tests",
preset: "jest-puppeteer",
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 67.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
describe("format largish attoREP", () => {
test("should return a properly formatted attoREP number", () => {
const result = formatNumber.formatAttoRep("3496805826822916500000", {
decimals: 4
});
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 67.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76