nexxtway/react-rainbow

View on GitHub

Showing 2,739 of 2,739 total issues

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

    async isLeftMonthDayFocused(day) {
        const buttonEl = await $(this.rootElement)
            .$$('table[role=grid]')[0]
            .$(`button=${day}`);
        return (await buttonEl.isExisting()) && (await buttonEl.isFocused());
Severity: Major
Found in src/components/Calendar/pageObject/doubleCalendar.js and 1 other location - About 2 hrs to fix
src/components/Calendar/pageObject/doubleCalendar.js on lines 271..276

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 84.

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

Further Reading

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

describe('<Avatar/>', () => {
    it('should pass assistiveText to the prop text of AssistiveText component', () => {
        const component = mount(<Avatar initials="JD" assistiveText="for screen readers" />);
        expect(component.find('AssistiveText').prop('text')).toBe('for screen readers');
    });
Severity: Major
Found in src/components/Avatar/__test__/avatar.spec.js and 1 other location - About 2 hrs to fix
src/components/PrimitiveCheckbox/__test__/label.spec.js on lines 5..10

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 84.

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

Further Reading

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

        if (indicatorIndex === indicatorsRefs.length - 1 && side === RIGHT_SIDE) {
            setAsSelectedIndicator(0);
        } else if (indicatorIndex === 0 && side === LEFT_SIDE) {
            setAsSelectedIndicator(indicatorsRefs.length - 1);
        } else {
Severity: Major
Found in src/components/CarouselCard/indicators/index.js and 1 other location - About 2 hrs to fix
src/components/Accordion/index.js on lines 52..58

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 84.

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

Further Reading

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

    it('should call onClick callback', () => {
        const clickFn = jest.fn();
        const component = mount(<ColorInput onClick={clickFn} />);
        component.find('input[type="text"]').simulate('click');
        expect(clickFn).toHaveBeenCalled();
Severity: Major
Found in src/components/ColorInput/__test__/colorInput.spec.js and 1 other location - About 2 hrs to fix
src/components/ImportRecordsFlow/stepThree/__test__/assignFieldModalFooter.spec.js on lines 13..18

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 84.

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

Further Reading

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

    it('should have a inside div with id="headerTest"', () => {
        const component = mount(<Textarea header={<div id="headerTest" />} />);
        const div = component.find('div[id="headerTest"]');
        expect(div.exists()).toBeTruthy();
    });
Severity: Major
Found in src/components/Textarea/__test__/textarea.spec.js and 1 other location - About 2 hrs to fix
src/components/Textarea/__test__/textarea.spec.js on lines 68..72

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 84.

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

Further Reading

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

        if (accordionSectionIndex === childrenRegistered.length - 1 && side === RIGHT_SIDE) {
            setAsSelectAccordionSection(0);
        } else if (accordionSectionIndex === 0 && side === LEFT_SIDE) {
            setAsSelectAccordionSection(childrenRegistered.length - 1);
        } else {
Severity: Major
Found in src/components/Accordion/index.js and 1 other location - About 2 hrs to fix
src/components/CarouselCard/indicators/index.js on lines 29..35

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 84.

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

Further Reading

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

    incrementHour() {
        const { hour } = this.state;
        const { hour24 } = this.props;
        const hourValue = hour || this.prevHour;
        this.setState({
Severity: Major
Found in src/components/TimePicker/timeSelect.js and 1 other location - About 2 hrs to fix
src/components/TimePicker/timeSelect.js on lines 346..353

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 84.

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

Further Reading

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

                        <g id="Group-176">
                            <g id="tile/social-copy-2" transform="translate(447.000000, 72.000000)">
                                <g id="tile/social">
                                    <g
                                        id="icon-twitter"
Severity: Major
Found in library/exampleComponents/Icons/twitter.js and 1 other location - About 2 hrs to fix
library/exampleComponents/Icons/linkedin.js on lines 17..33

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 84.

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

Further Reading

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

    async isRightMonthDayFocused(day) {
        const buttonEl = await $(this.rootElement)
            .$$('table[role=grid]')[1]
            .$(`button=${day}`);
        return (await buttonEl.isExisting()) && (await buttonEl.isFocused());
Severity: Major
Found in src/components/Calendar/pageObject/doubleCalendar.js and 1 other location - About 2 hrs to fix
src/components/Calendar/pageObject/doubleCalendar.js on lines 152..157

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 84.

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

Further Reading

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

    it('should run assign method when assign button is clicked', () => {
        const onAssignFn = jest.fn();
        const component = shallow(<AssignFieldModalFooter onAssign={onAssignFn} />);
        component.find('Button').simulate('click');
        expect(onAssignFn).toHaveBeenCalled();
src/components/ColorInput/__test__/colorInput.spec.js on lines 86..91

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 84.

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

Further Reading

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

    decrementHour() {
        const { hour } = this.state;
        const { hour24 } = this.props;
        const hourValue = hour || this.prevHour;
        this.setState({
Severity: Major
Found in src/components/TimePicker/timeSelect.js and 1 other location - About 2 hrs to fix
src/components/TimePicker/timeSelect.js on lines 337..344

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 84.

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

Further Reading

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

describe('<InputCheckboxLabel/>', () => {
    it('should set the inputId passed as the htmlFor prop in the label element', () => {
        const component = mount(<Label label="Input Label" inputId="input-213" />);
        expect(component.find('label').prop('htmlFor')).toBe('input-213');
    });
Severity: Major
Found in src/components/PrimitiveCheckbox/__test__/label.spec.js and 1 other location - About 2 hrs to fix
src/components/Avatar/__test__/avatar.spec.js on lines 5..10

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 84.

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

Further Reading

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

    render() {
        const {
            style,
            className,
            label,
Severity: Major
Found in src/components/RadioButtonGroup/index.js - About 2 hrs to fix

    Function MenuContent has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function MenuContent(props) {
        const { children, isLoading, ariaLabel, onRequestClose } = props;
        const childrenRefs = useRef([]);
        const containerRef = useRef();
        const [childCount, setChildCount] = useState(0);
    Severity: Major
    Found in src/components/PrimitiveMenu/menuContent.js - About 2 hrs to fix

      Function Accordion has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Accordion = props => {
          const { id, children, style, className, activeSectionNames, multiple, onToggleSection } = props;
          const containerRef = useRef();
      
          const [activeNames, setActiveNames] = useState(activeSectionNames);
      Severity: Major
      Found in src/components/Accordion/index.js - About 2 hrs to fix

        Function StepThree has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function StepThree(props) {
            const { attributes, columns, onAssignField, fieldsMap, data, matchField, borderRadius } = props;
            const previewData = data.slice(0, 3);
        
            const [assignData, setAssignData] = useState([]);
        Severity: Major
        Found in src/components/ImportRecordsFlow/stepThree/index.js - About 2 hrs to fix

          Function CustomWorkIcon has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const CustomWorkIcon = props => {
              const { className } = props;
              return (
                  <svg className={className} width="24px" height="22px" viewBox="0 0 24 22" version="1.1">
                      <g id="pages" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
          Severity: Major
          Found in library/styleguideComponents/ComponentsList/icons/customWorkIcon.js - About 2 hrs to fix

            Function File has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const File = props => {
                const { className, style } = props;
                return (
                    <svg className={className} style={style} width="16px" height="20px" viewBox="0 0 16 20">
                        <g id="components" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
            Severity: Major
            Found in library/exampleComponents/Icons/file.js - About 2 hrs to fix

              Function filterCountries has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function filterCountries(query, countries, country) {
                  if (query === '' || query === '+') {
                      const filteredCountries = countries.filter(value => value.isoCode !== country.isoCode);
                      filteredCountries.unshift(country);
                      return filteredCountries;

              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 tableWithBrowserPagination.spec.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React from 'react';
              import { mount } from 'enzyme';
              import TableWithBrowserPagination from '../index';
              import Pagination from '../../Pagination';
              import Table from '../../Table';
                Severity
                Category
                Status
                Source
                Language