react-bootstrap/react-bootstrap

View on GitHub

Showing 113 of 376 total issues

Function PlacementExample has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function PlacementExample() {
  const [position, setPosition] = useState('top-start');

  return (
    <>
Severity: Major
Found in www/docs/examples/Toast/Placement.js - About 2 hrs to fix

    Function exports has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = (config) => {
      const { env } = process;
    
      config.set({
        frameworks: ['mocha', 'webpack', 'sinon-chai'],
    Severity: Major
    Found in karma.conf.js - About 2 hrs to fix

      Function ThemedLiveEditor has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      function ThemedLiveEditor() {
        const { code } = useContext(LiveContext);
        const isBrowser = useIsBrowser();
        const [focused, setFocused] = useState(false);
        const [ignoreTab, setIgnoreTab] = useState(false);
      Severity: Minor
      Found in www/src/theme/Playground/index.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 OffcanvasExample has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function OffcanvasExample() {
        return (
          <>
            {[false, 'sm', 'md', 'lg', 'xl', 'xxl'].map((expand) => (
              <Navbar key={expand} expand={expand} className="bg-body-tertiary mb-3">
      Severity: Major
      Found in www/docs/examples/Navbar/Offcanvas.js - About 2 hrs to fix

        Function ToggleButtonGroup has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        > = React.forwardRef<HTMLElement, ToggleButtonGroupProps<any>>((props, ref) => {
          const {
            children,
            type = 'radio',
            name,
        Severity: Major
        Found in src/ToggleButtonGroup.tsx - About 2 hrs to fix

          Function Alert has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            (uncontrolledProps: AlertProps, ref) => {
              const {
                bsPrefix,
                show = true,
                closeLabel = 'Close alert',
          Severity: Minor
          Found in src/Alert.tsx - About 2 hrs to fix

            Function PopoverPositionedScrollingExample has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function PopoverPositionedScrollingExample() {
              const popover = (position) => (
                <Popover id={`popover-positioned-scrolling-${position}`}>
                  <Popover.Header as="h3">{`Popover ${position}`}</Popover.Header>
                  <Popover.Body>
            Severity: Minor
            Found in www/docs/examples/Overlays/PopoverPositionedScrolling.js - About 1 hr to fix

              Function GridComplexExample has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function GridComplexExample() {
                return (
                  <Form>
                    <Row className="mb-3">
                      <Form.Group as={Col} controlId="formGridEmail">
              Severity: Minor
              Found in www/docs/examples/Form/GridComplex.js - About 1 hr to fix

                Function BrandExample has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function BrandExample() {
                  return (
                    <>
                      <Navbar className="bg-body-tertiary">
                        <Container>
                Severity: Minor
                Found in www/docs/examples/Navbar/Brand.js - About 1 hr to fix

                  Function AutoCloseExample has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function AutoCloseExample() {
                    return (
                      <>
                        <Dropdown className="d-inline mx-2">
                          <Dropdown.Toggle id="dropdown-autoclose-true">
                  Severity: Minor
                  Found in www/docs/examples/Dropdown/AutoClose.js - About 1 hr to fix

                    Function GroupExample has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function GroupExample() {
                      return (
                        <CardGroup>
                          <Card>
                            <Card.Img variant="top" src="holder.js/100px160" />
                    Severity: Minor
                    Found in www/docs/examples/Card/Group.js - About 1 hr to fix

                      Function DropdownMenu has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          (
                            {
                              bsPrefix,
                              className,
                              align,
                      Severity: Minor
                      Found in src/DropdownMenu.tsx - 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 useOverlayOffset has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function useOverlayOffset(
                        customOffset?: Offset,
                      ): [React.RefObject<HTMLElement>, Options['modifiers']] {
                        const overlayRef = useRef<HTMLDivElement | null>(null);
                        const popoverClass = useBootstrapPrefix(undefined, 'popover');
                      Severity: Minor
                      Found in src/useOverlayOffset.tsx - 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 DropDirectioExample has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function DropDirectioExample() {
                        return (
                          <>
                            <div className="mb-2">
                              {['up', 'up-centered', 'down', 'down-centered', 'start', 'end'].map(
                      Severity: Minor
                      Found in www/docs/examples/Dropdown/DropDirections.js - About 1 hr to fix

                        Function Tabs has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const Tabs = (props: TabsProps) => {
                          const {
                            id,
                            onSelect,
                            transition,
                        Severity: Minor
                        Found in src/Tabs.tsx - About 1 hr to fix

                          Function visitCallExpression has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              visitCallExpression(path) {
                                if (types.ExpressionStatement.check(path.node)) {
                                  path = path.get('expression');
                                }
                                if (path.node.type !== 'CallExpression') return false;
                          Severity: Minor
                          Found in www/plugins/react-docgen-plugin/resolveHocComponents.js - About 1 hr to fix

                            Function DismissibleExample has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function DismissibleExample() {
                              const [showA, setShowA] = useState(true);
                              const [showB, setShowB] = useState(true);
                            
                              const toggleShowA = () => setShowA(!showA);
                            Severity: Minor
                            Found in www/docs/examples/Toast/Dismissible.js - About 1 hr to fix

                              Function Example has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function Example() {
                                const [show, setShow] = useState(false);
                              
                                const handleClose = () => setShow(false);
                                const handleShow = () => setShow(true);
                              Severity: Minor
                              Found in www/docs/examples/Modal/Focus.js - About 1 hr to fix

                                Function Nav has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                >((uncontrolledProps, ref) => {
                                  const {
                                    as = 'div',
                                    bsPrefix: initialBsPrefix,
                                    variant,
                                Severity: Minor
                                Found in src/Nav.tsx - About 1 hr to fix

                                  Function ToolbarExample has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function ToolbarExample() {
                                    return (
                                      <>
                                        <ButtonToolbar className="mb-3" aria-label="Toolbar with Button groups">
                                          <ButtonGroup className="me-2" aria-label="First group">
                                  Severity: Minor
                                  Found in www/docs/examples/ButtonGroup/Toolbar.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language