nexxtway/react-rainbow

View on GitHub

Showing 445 of 2,739 total issues

Function FileSelector has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const FileSelector = React.forwardRef((props, ref) => {
    const {
        className,
        style,
        id,
Severity: Minor
Found in src/components/FileSelector/index.js - About 1 hr to fix

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 Hex has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function Hex() {
    const { hex, tabIndex, onChange } = useContext(ColorPickerContext);
    const [color, setColor] = useState(hex.substr(1));
    const [isFocused, setIsFocused] = useState(false);

Severity: Minor
Found in src/components/ColorPicker/commons/hex/index.js - About 1 hr to fix

    Function Messages has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Messages = props => {
        const { className, style } = props;
        return (
            <svg
                className={className}
    Severity: Minor
    Found in library/exampleComponents/Icons/messages.js - About 1 hr to fix

      Function FolderOpen has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function Comments has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Comments = props => {
            const { className, style } = props;
            return (
                <svg
                    className={className}
        Severity: Minor
        Found in library/exampleComponents/Icons/comments.js - About 1 hr to fix

          Function Week has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function Week(props) {
              const { week, events, onEventClick, onScroll, locale } = props;
          
              function Days() {
                  return Array.from(Array(7), (_value, index) => {
          Severity: Minor
          Found in src/components/WeeklyCalendar/week/index.js - About 1 hr to fix

            Function ErrorIcon has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function ErrorIcon() {
                return (
                    <svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
                        <g id="components" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
                            <g
            Severity: Minor
            Found in src/components/FileSelector/icons/error.js - About 1 hr to fix

              Function AvatarExample has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function AvatarExample() {
                  return (
                      <div>
                          <Avatar
                              className="rainbow-m-horizontal_medium"
              Severity: Minor
              Found in examples/create-react-app/src/pages/Avatar/index.js - About 1 hr to fix

                Function PageButtons has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function PageButtons(props) {
                    const { pages, activePage, onChange, variant } = props;
                
                    const getAriaCurrent = page => {
                        if (page === activePage) {
                Severity: Minor
                Found in src/components/Pagination/pageButtons.js - About 1 hr to fix

                  Function useOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function useOptions(props) {
                      const {
                          currency,
                          currencyDisplay,
                          currencySign,
                  Severity: Minor
                  Found in src/components/CurrencyInput/hooks/useOptions.js - About 1 hr to fix

                    Function Edit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function Edit(props) {
                        const { className, style } = props;
                        return (
                            <svg
                                width="14px"
                    Severity: Minor
                    Found in src/components/Table/body/icons/edit.js - About 1 hr to fix

                      Function Calendar has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function Calendar(props) {
                          const { locale, selectionType, variant, value, onChange, ...rest } = props;
                          const currentLocale = useLocale(locale);
                          const currentValue = useCurrentDateFromValue(value);
                          const range = useRangeFromValue(value, selectionType);
                      Severity: Minor
                      Found in src/components/Calendar/index.js - About 1 hr to fix

                        Function constructor has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            constructor(props) {
                                super(props);
                                this.state = {
                                    hour: getHour(props.value),
                                    minutes: getMinutes(props.value),
                        Severity: Minor
                        Found in src/components/TimePicker/timeSelect.js - About 1 hr to fix

                          Function Month has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export default function Month(props) {
                              const { firstDayMonth, selectedDate, minDate, maxDate, onSelectDate } = props;
                              let date = new Date(firstDayMonth);
                              const lastDayMonth = useMemo(() => getLastDayMonth(firstDayMonth), [firstDayMonth]);
                              const weeks = [];
                          Severity: Minor
                          Found in src/components/MonthlyCalendar/month.js - About 1 hr to fix

                            Function Week has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export default function Week(props) {
                                const {
                                    selectedDate,
                                    startDate,
                                    endDate,
                            Severity: Minor
                            Found in src/components/MonthlyCalendar/week.js - About 1 hr to fix

                              Function CheckmarkIcon has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export default function CheckmarkIcon(props) {
                                  const { className, style } = props;
                                  return (
                                      <svg
                                          className={className}
                              Severity: Minor
                              Found in src/components/Option/checkmark.js - About 1 hr to fix

                                Function buildPlainListFromTree has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export default function buildPlainListFromTree(tree, parentName, parentPath) {
                                    if (!Array.isArray(tree)) return [];
                                    return tree.reduce((result, node, index) => {
                                        const nodeName = getNodeName({ parentName, index });
                                        const level = getNodeLevel({ name: nodeName });
                                Severity: Minor
                                Found in src/components/Tree/helpers/buildPlainListFromTree.js - About 1 hr to fix

                                  Function Color has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const Color = React.forwardRef((props, ref) => {
                                      const { color, name, tabIndex, isChecked, onChange } = props;
                                      const rgba = colorToRgba(color);
                                      const colorId = useUniqueIdentifier('color-picker-default');
                                      if (!isValidColor(rgba)) {
                                  Severity: Minor
                                  Found in src/components/ColorPicker/commons/defaultColors/color.js - About 1 hr to fix

                                    Function DoneIcon has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export default function DoneIcon(props) {
                                        const { className, style } = props;
                                        return (
                                            <svg
                                                className={className}
                                    Severity: Minor
                                    Found in src/components/ProgressStep/doneIcon.js - About 1 hr to fix

                                      Function CountriesList has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      const CountriesList = memo(props => {
                                          const { countries, country, itemsRef, handleCountryChange, handleActiveChange } = props;
                                          const list = useSimulatedLoading(countries, 15);
                                      
                                          return list.map((value, index) => {
                                      Severity: Minor
                                      Found in src/components/PhoneInput/countriesDropdown/countriesList.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language