jtassin/react-amount-field

View on GitHub

Showing 19 of 19 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<div style={{ height: '50px' }}>
<div style={{ width: '50%', float: 'left' }}>
{this.state.val}
</div>
<div style={{ width: '50%', float: 'left' }}>
Severity: Major
Found in examples/src/Example2.jsx and 1 other location - About 7 hrs to fix
examples/src/Example1.jsx on lines 15..25

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<div style={{ height: '50px' }}>
<div style={{ width: '50%', float: 'left' }}>
{this.state.val}
</div>
<div style={{ width: '50%', float: 'left' }}>
Severity: Major
Found in examples/src/Example1.jsx and 1 other location - About 7 hrs to fix
examples/src/Example2.jsx on lines 20..32

Similar blocks of code found in 5 locations. Consider refactoring.
Open

it('treat , like .', (done) => {
const props = {
value: '215',
};
props[key] = (value) => {
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 4 other locations - About 5 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 76..90
src/__tests__/ReactAmountField.test.jsx on lines 108..122
src/__tests__/ReactAmountField.test.jsx on lines 124..138
src/__tests__/ReactAmountField.test.jsx on lines 140..154

Similar blocks of code found in 5 locations. Consider refactoring.
Open

it('when called on children transmit it to parent with value multiplied by 100', (done) => {
const props = {
value: '215',
};
props[key] = (value) => {
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 4 other locations - About 5 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 108..122
src/__tests__/ReactAmountField.test.jsx on lines 124..138
src/__tests__/ReactAmountField.test.jsx on lines 140..154
src/__tests__/ReactAmountField.test.jsx on lines 156..170

Similar blocks of code found in 5 locations. Consider refactoring.
Open

it('refuses more than 2 decimals', (done) => {
const props = {
value: '215',
};
props[key] = (value) => {
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 4 other locations - About 5 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 76..90
src/__tests__/ReactAmountField.test.jsx on lines 108..122
src/__tests__/ReactAmountField.test.jsx on lines 140..154
src/__tests__/ReactAmountField.test.jsx on lines 156..170

Similar blocks of code found in 5 locations. Consider refactoring.
Open

it('escape non digit chars', (done) => {
const props = {
value: '215',
};
props[key] = (value) => {
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 4 other locations - About 5 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 76..90
src/__tests__/ReactAmountField.test.jsx on lines 108..122
src/__tests__/ReactAmountField.test.jsx on lines 124..138
src/__tests__/ReactAmountField.test.jsx on lines 156..170

Similar blocks of code found in 5 locations. Consider refactoring.
Open

it('works with input type="text"', (done) => {
const props = {
value: '215',
};
props[key] = (value) => {
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 4 other locations - About 5 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 76..90
src/__tests__/ReactAmountField.test.jsx on lines 124..138
src/__tests__/ReactAmountField.test.jsx on lines 140..154
src/__tests__/ReactAmountField.test.jsx on lines 156..170

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it('accept number value', () => {
const wrapper = shallow(
<ReactAmountField className="bar" value={1337}><span /></ReactAmountField>,
);
expect(wrapper.html()).to.equal('<div><span class="bar" value="13.37"></span></div>');
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 1 other location - About 2 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 51..56

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it('handle value equals to 0 (integer)', () => {
const wrapper = shallow(
<ReactAmountField className="bar" value={0}><span /></ReactAmountField>,
);
expect(wrapper.html()).to.equal('<div><span class="bar" value="0"></span></div>');
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 1 other location - About 2 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 30..35

Function render has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const ExampleForm = function render(props) {
const {
handleSubmit,
resolvedValue,
resolvedVisited,
Severity: Minor
Found in examples/src/ReduxFormExample.jsx - About 1 hr to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    beforeEach(() => {
    const stub = sinon.stub(console, 'error');
    stub.callsFake((warning) => { throw new Error(warning); });
    });
    Severity: Major
    Found in src/__tests__/ReactAmountField.test.jsx and 1 other location - About 1 hr to fix
    src/__tests__/ReduxFormMaterialUiWrapper.test.jsx on lines 22..25

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    beforeEach(() => {
    const stub = sinon.stub(console, 'error');
    stub.callsFake((warning) => { throw new Error(warning); });
    });
    Severity: Major
    Found in src/__tests__/ReduxFormMaterialUiWrapper.test.jsx and 1 other location - About 1 hr to fix
    src/__tests__/ReactAmountField.test.jsx on lines 23..26

    Function mapStateToProps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    function mapStateToProps(state) {
    let resolvedValue = null;
    let resolvedVisited = false;
    let resolvedTouched = false;
    let resolvedActive = false;
    Severity: Minor
    Found in examples/src/ReduxFormExample.jsx - About 1 hr to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    module.hot.accept('./ReduxFormExample', () => {
    // If you use Webpack 2 in ES modules mode, you can
    // use <App /> here rather than require() a <NextApp />.
    ReactDOM.render(
    <AppContainer>
    Severity: Major
    Found in examples/src/example.jsx and 2 other locations - About 1 hr to fix
    examples/src/example.jsx on lines 51..60
    examples/src/example.jsx on lines 73..82

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    module.hot.accept('./Example2', () => {
    // If you use Webpack 2 in ES modules mode, you can
    // use <App /> here rather than require() a <NextApp />.
    ReactDOM.render(
    <AppContainer>
    Severity: Major
    Found in examples/src/example.jsx and 2 other locations - About 1 hr to fix
    examples/src/example.jsx on lines 51..60
    examples/src/example.jsx on lines 62..71

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    module.hot.accept('./Example1', () => {
    // If you use Webpack 2 in ES modules mode, you can
    // use <App /> here rather than require() a <NextApp />.
    ReactDOM.render(
    <AppContainer>
    Severity: Major
    Found in examples/src/example.jsx and 2 other locations - About 1 hr to fix
    examples/src/example.jsx on lines 62..71
    examples/src/example.jsx on lines 73..82

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    if (form.reduxForm.fields.field.visited) {
    resolvedVisited = form.reduxForm.fields.field.visited;
    }
    Severity: Minor
    Found in examples/src/ReduxFormExample.jsx and 2 other locations - About 35 mins to fix
    examples/src/ReduxFormExample.jsx on lines 71..73
    examples/src/ReduxFormExample.jsx on lines 74..76

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    if (form.reduxForm.fields.field.touched) {
    resolvedTouched = form.reduxForm.fields.field.touched;
    }
    Severity: Minor
    Found in examples/src/ReduxFormExample.jsx and 2 other locations - About 35 mins to fix
    examples/src/ReduxFormExample.jsx on lines 68..70
    examples/src/ReduxFormExample.jsx on lines 74..76

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    if (form.reduxForm.fields.field.active) {
    resolvedActive = form.reduxForm.fields.field.active;
    }
    Severity: Minor
    Found in examples/src/ReduxFormExample.jsx and 2 other locations - About 35 mins to fix
    examples/src/ReduxFormExample.jsx on lines 68..70
    examples/src/ReduxFormExample.jsx on lines 71..73
    Severity
    Category
    Status
    Source
    Language