react-bootstrap/react-bootstrap

View on GitHub

Showing 113 of 376 total issues

Function Carousel has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

    ({ defaultActiveIndex = 0, ...uncontrolledProps }, ref) => {
      const {
        // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
        as: Component = 'div',
        bsPrefix,
Severity: Minor
Found in src/Carousel.tsx - About 1 day 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

File Carousel.tsx has 477 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import useEventCallback from '@restart/hooks/useEventCallback';
import useUpdateEffect from '@restart/hooks/useUpdateEffect';
import useCommittedRef from '@restart/hooks/useCommittedRef';
import useTimeout from '@restart/hooks/useTimeout';
import Anchor from '@restart/ui/Anchor';
Severity: Minor
Found in src/Carousel.tsx - About 7 hrs to fix

    Function ResponsiveBreakpointsExample has 172 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function ResponsiveBreakpointsExample() {
      return (
        <div>
          <Table responsive="sm">
            <thead>
    Severity: Major
    Found in www/docs/examples/Table/ResponsiveBreakpoints.js - About 6 hrs to fix

      Function FormExample has 170 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function FormExample() {
        const { Formik } = formik;
      
        const schema = yup.object().shape({
          firstName: yup.string().required(),
      Severity: Major
      Found in www/docs/examples/Form/ValidationTooltips.js - About 6 hrs to fix

        Function Modal has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

            (
              {
                bsPrefix,
                className,
                style,
        Severity: Minor
        Found in src/Modal.tsx - About 5 hrs 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 FormExample has 129 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function FormExample() {
          const { Formik } = formik;
        
          const schema = yup.object().shape({
            firstName: yup.string().required(),
        Severity: Major
        Found in www/docs/examples/Form/ValidationFormik.js - About 5 hrs to fix

          File Modal.tsx has 336 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import classNames from 'classnames';
          import addEventListener from 'dom-helpers/addEventListener';
          import canUseDOM from 'dom-helpers/canUseDOM';
          import ownerDocument from 'dom-helpers/ownerDocument';
          import removeEventListener from 'dom-helpers/removeEventListener';
          Severity: Minor
          Found in src/Modal.tsx - About 4 hrs to fix

            Function BorderExample has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function BorderExample() {
              return (
                <>
                  <Card border="primary" style={{ width: '18rem' }}>
                    <Card.Header>Header</Card.Header>
            Severity: Major
            Found in www/docs/examples/Card/Border.js - About 3 hrs to fix

              Function Dropdown has 84 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                React.forwardRef<HTMLElement, DropdownProps>((pProps, ref) => {
                  const {
                    bsPrefix,
                    drop = 'down',
                    show,
              Severity: Major
              Found in src/Dropdown.tsx - About 3 hrs to fix

                Function FormExample has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function FormExample() {
                  const [validated, setValidated] = useState(false);
                
                  const handleSubmit = (event) => {
                    const form = event.currentTarget;
                Severity: Major
                Found in www/docs/examples/Form/ValidationNative.js - About 3 hrs to fix

                  Function ThemedLiveEditor has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function ThemedLiveEditor() {
                    const { code } = useContext(LiveContext);
                    const isBrowser = useIsBrowser();
                    const [focused, setFocused] = useState(false);
                    const [ignoreTab, setIgnoreTab] = useState(false);
                  Severity: Major
                  Found in www/src/theme/Playground/index.tsx - About 2 hrs to fix

                    Function ToggleButtonExample has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function ToggleButtonExample() {
                      const [checked, setChecked] = useState(false);
                      const [radioValue, setRadioValue] = useState('1');
                    
                      const radios = [
                    Severity: Major
                    Found in www/docs/examples/Button/ToggleButton.js - About 2 hrs to fix

                      Function getDropdownMenuPlacement has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function getDropdownMenuPlacement(
                        alignEnd: boolean,
                        dropDirection?: DropDirection,
                        isRTL?: boolean,
                      ) {
                      Severity: Minor
                      Found in src/DropdownMenu.tsx - About 2 hrs 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 exports has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      module.exports = (ast) => {
                        let components = resolver.findAllComponentDefinitions(ast);
                      
                        const getComment = (path) => {
                          let searchPath = path;
                      Severity: Minor
                      Found in www/plugins/react-docgen-plugin/resolveHocComponents.js - About 2 hrs 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 exports has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      module.exports = (ast) => {
                        let components = resolver.findAllComponentDefinitions(ast);
                      
                        const getComment = (path) => {
                          let searchPath = path;
                      Severity: Major
                      Found in www/plugins/react-docgen-plugin/resolveHocComponents.js - About 2 hrs to fix

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

                            (
                              {
                                bsPrefix,
                                className,
                                children,
                        Severity: Minor
                        Found in src/Offcanvas.tsx - About 2 hrs 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 Navbar has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          React.forwardRef<HTMLElement, NavbarProps>((props, ref) => {
                            const {
                              bsPrefix: initialBsPrefix,
                              expand = true,
                              variant = 'light',
                        Severity: Major
                        Found in src/Navbar.tsx - About 2 hrs to fix

                          Function ButtonDropdownsExample has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function ButtonDropdownsExample() {
                            return (
                              <>
                                <InputGroup className="mb-3">
                                  <DropdownButton
                          Severity: Major
                          Found in www/docs/examples/InputGroup/ButtonDropdowns.js - About 2 hrs to fix

                            Function HorizontalExample has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function HorizontalExample() {
                              return (
                                <Form>
                                  <Form.Group as={Row} className="mb-3" controlId="formHorizontalEmail">
                                    <Form.Label column sm={2}>
                            Severity: Major
                            Found in www/docs/examples/Form/Horizontal.js - About 2 hrs to fix

                              Function Dropdown has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                              Open

                                React.forwardRef<HTMLElement, DropdownProps>((pProps, ref) => {
                                  const {
                                    bsPrefix,
                                    drop = 'down',
                                    show,
                              Severity: Minor
                              Found in src/Dropdown.tsx - About 2 hrs 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

                              Severity
                              Category
                              Status
                              Source
                              Language