gymnastjs/gymnast

View on GitHub

Showing 6 of 22 total issues

File index.spec.tsx has 327 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { size } from 'lodash'
import defaults from '../defaults'
import {
  accumulateOver,
  combineSpacing,
Severity: Minor
Found in src/utils/index.spec.tsx - About 3 hrs to fix

    Function useGrid has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function useGrid<A extends {}>(
      props: GridProps & A
    ): [
      boolean,
      A & { className: string | undefined; style: React.CSSProperties }
    Severity: Major
    Found in src/useGrid/index.tsx - About 2 hrs to fix

      Function useResolution has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function useResolution<A extends GridProps>(
        resolutionKeys: Array<string>,
        props: A,
        allowMatchMedia: boolean = supportsMatchMedia
      ): [boolean, A & OneResolutionGrid] {
      Severity: Minor
      Found in src/useResolution/index.tsx - About 1 hr to fix

        Function getSpacing has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getSpacing(
          values: Array<number> | void = [],
          type: 'margin' | 'padding'
        ): { [CSSProp: string]: number } {
          if (!values || !values.length) {
        Severity: Minor
        Found in src/utils/index.tsx - About 1 hr to fix

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

          module.exports = ({ config }) => {
            if (config.module && config.module.rules) {
              config.module.rules.push({
                test: /\.(ts|tsx)$/,
                loader: require.resolve('babel-loader'),
          Severity: Minor
          Found in storybook/webpack.config.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 matchMedia has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          global.matchMedia = function matchMedia(media: string) {
            allListeners[media] = allListeners[media] || []
          
            return {
              media,
          Severity: Minor
          Found in test/env.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

          Severity
          Category
          Status
          Source
          Language