grommet/grommet

View on GitHub

Showing 545 of 2,098 total issues

Function viewToFormValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const viewToFormValue = (view) => {
  const result = { ...(view?.properties || {}) };
  // convert { min: , max: } range to [min, max] for RangeSelector
  Object.keys(result).forEach((key) => {
    if (
Severity: Minor
Found in src/js/components/Data/DataForm.js - About 25 mins 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 Collapsible has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  ({ children, direction, open: openArg }, ref) => {
    const theme = useContext(ThemeContext) || defaultProps.theme;
    const [open, setOpen] = useState(openArg);
    const [animate, setAnimate] = useState(false);
    const [speed, setSpeed] = useState(theme.collapsible.minSpeed);
Severity: Minor
Found in src/js/components/Collapsible/Collapsible.js - About 25 mins 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 CustomSuggestions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const CustomSuggestions = () => {
  const [value, setValue] = useState('');
  const [suggestionOpen, setSuggestionOpen] = useState(false);
  const [suggestions, setSuggestions] = useState([]);
  const boxRef = useRef();
Severity: Minor
Found in src/js/components/TextInput/stories/CustomThemed/CustomSuggestions.tsx - About 25 mins 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 ButtonWithChildren has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ButtonWithChildren = (props) => (
  <Button hoverIndicator="light-1" onClick={() => {}} {...props}>
    {({ disabled, hover, focus }) => (
      <Box pad="small" direction="row" align="center" gap="small">
        {hover || disabled ? <Add color="brand" /> : <Add />}
Severity: Minor
Found in src/js/components/Button/stories/typescript/Children.tsx - About 25 mins 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 SkipLinks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const SkipLinks = ({ children, id, messages }) => {
  const theme = useContext(ThemeContext) || defaultProps.theme;
  const [showLayer, setShowLayer] = useState(false);
  const { format } = useContext(MessageContext);
  const layerRef = useRef(null);
Severity: Minor
Found in src/js/components/SkipLinks/SkipLinks.js - About 25 mins 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