Showing 124 of 126 total issues
Similar blocks of code found in 13 locations. Consider refactoring. Open
describe('(Container) OasisMyOrdersContainer', () => {
const state = fromJS(global.storeMock);
const initialProps = mapStateToProps(state);
const initialActions = mapDispatchToProps(x => x);
const props = {
- Read upRead up
- Create a ticketCreate a ticket
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 169.
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 13 locations. Consider refactoring. Open
describe('(Container) OasisNotTheBestOfferPriceWarning', () => {
const state = fromJS(global.storeMock);
const initialProps = mapStateToProps(state);
const initialActions = mapDispatchToProps(x => x);
const props = {
- Read upRead up
- Create a ticketCreate a ticket
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 169.
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 13 locations. Consider refactoring. Open
describe('(Container) OasisYourNodeIsSyncing', () => {
const state = fromJS(global.storeMock);
const initialProps = mapStateToProps(state);
const initialActions = mapDispatchToProps(x => x);
const props = {
- Read upRead up
- Create a ticketCreate a ticket
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 169.
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
Function healthCheck
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export const healthCheck = async (
dispatch,
getState,
isInitialHealthcheck = false
) => {
- 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 96 lines of code (exceeds 50 allowed). Consider refactoring. Open
export const onNetworkCheckEndEpic = (
dispatch,
getState,
setInitialSubscriptions,
accountChanged
- Create a ticketCreate a ticket
OasisTakeOfferModalWrapper
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export class OasisTakeOfferModalWrapper extends PureComponent {
static takeOfferBtnLabel(offerTakeType, { buyToken, sellToken }) {
switch (offerTakeType) {
case TAKE_SELL_OFFER:
return `Buy ${buyToken}`;
- Create a ticketCreate a ticket
Function render
has 91 lines of code (exceeds 50 allowed). Consider refactoring. Open
render() {
const {
handleSubmit,
valid,
makeTransfer,
- Create a ticketCreate a ticket
Function loadGNTWrapUnwrapsHistoryEpic
has 88 lines of code (exceeds 50 allowed). Consider refactoring. Open
const loadGNTWrapUnwrapsHistoryEpic = (address, config) => async (
dispatch,
getState
) => {
const tokenName = TOKEN_GOLEM;
- Create a ticketCreate a ticket
SetTokenAllowanceTrustWrapper
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
export class SetTokenAllowanceTrustWrapper extends PureComponent {
constructor(props) {
super(props);
this.state = {
isToggleAllowanceTxPending: false
- Create a ticketCreate a ticket
Function render
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
render() {
const {
valid,
handleSubmit,
initialized,
- Create a ticketCreate a ticket
Function render
has 78 lines of code (exceeds 50 allowed). Consider refactoring. Open
render() {
const {
valid,
handleSubmit,
unwrappedToken,
- Create a ticketCreate a ticket
Function loadEtherWrapUnwrapsHistoryEpic
has 78 lines of code (exceeds 50 allowed). Consider refactoring. Open
const loadEtherWrapUnwrapsHistoryEpic = (address, config) => async (
dispatch,
getState
) => {
dispatch(loadWrapUnwrapsHistory$.pending());
- Create a ticketCreate a ticket
Function loadContact
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function loadContact(abi, contractAddress, noProxy) {
try {
if (!web3.isAddress(contractAddress)) {
throw new Error({
msg: "contract address argument is not an valid ethereum address"
- 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
File wrapUnwrap.js
has 503 lines of code (exceeds 500 allowed). Consider refactoring. Open
import { createAction, handleActions } from "redux-actions";
import { fromJS } from "immutable";
import { reset, formValueSelector, change } from "redux-form/immutable";
import {
- Create a ticketCreate a ticket
Function render
has 74 lines of code (exceeds 50 allowed). Consider refactoring. Open
render() {
const {
offerTakeType,
sellToken,
buyToken,
- Create a ticketCreate a ticket
Function render
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
render() {
const { latestBlock: { number } = {} } = this.props;
return (
<section className={styles.LockedAccountSection}>
<div>
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
describe('buyMaxEpic', () => {
each([["max lower than offer", 13, 3, 12],
["max greater than offer", 1, 3, 12]])
.test("%s", (description, balance, howMutch, price) => {
const store = configureMockStore([thunk2Data(), thunk])({});
- Read upRead up
- Create a ticketCreate a ticket
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 148.
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 2 locations. Consider refactoring. Open
describe('sellMaxEpic', () => {
each([["balance greater than the offer", 13, 3, 12],
["balance lower than the offer", 1, 3, 12]])
.test("%s", (description, balance, howMutch, price) => {
const store = configureMockStore([thunk2Data(), thunk])({});
- Read upRead up
- Create a ticketCreate a ticket
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 148.
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
Function render
has 72 lines of code (exceeds 50 allowed). Consider refactoring. Open
render() {
return (
<Line
height={CHART_HEIGHT}
data={{
- Create a ticketCreate a ticket
Function init
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
const init = networkName => {
const tokencontractsDeploymentAdressessList = config["tokens"][networkName];
const marketDeploymentAddress = config["market"][networkName]["address"];
const WETH = loadContact(
- Create a ticketCreate a ticket